stayscrisp's Profile User Rating: *****

Reputation: 1024 Grandmaster
Group:
Alumni
Active Posts:
4,346 (1.61 per day)
Joined:
14-February 08
Profile Views:
110,538
Last Active:
User is offline Yesterday, 10:47 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Nintendo
Your Car:
Hyundai
Dream Kudos:
525
Expert In:
Game Programming, C++, Graphic Design

Latest Visitors

Icon   stayscrisp それググ

Posts I've Made

  1. In Topic: .exe problem visual studio!

    Posted 30 Jun 2015

    Please follow these steps.
    https://msdn.microso...y/ms235629.aspx
  2. In Topic: Game programming!

    Posted 27 Jun 2015

    You might want to just go the middle ground here and use an existing engine without the big editor package.

    Irrlicht is a great example:
    http://irrlicht.sourceforge.net/

    This way you'll be coding in C++ and if you want to see how DirectX or OpenGL are used within the engine, then the source code is all there for your perusal.
  3. In Topic: Apple Tv's Airplay & Programming

    Posted 22 Jun 2015

    The lag is pretty poor for a straight mirror to be honest. I attempted to use my Apple TV in this way and gave up pretty quickly. It's great for what it's supposed to be used for though, and an excellent way to mirror your ios device when testing.
  4. In Topic: allegro file difficulty...

    Posted 22 Jun 2015

    Yes, you definitely need to go back to basics here. I'll give you a starting point with this code you have, but before you go any further I suggest that you look at some absolute beginners tutorials.

    I say this because you don't seem to even recognise comments, this is pretty much stage 0 of programming and shouldn't pose any effort to you at all if you expect to attempt even the most basic console program.

    But everyone has to start somewhere so don't feel too disheartened.

    Here is an untested version of your code for you to peruse (with comments) and fix and get ideas of how to lay out your code.

    #include <iostream>
    #include "allegro_ttf.h"
    
    using namespace std;
    
    // declare some functions to do initialisation & display
    bool init_allegro();
    void update_display();
    void cleanup();
    
    // global variables are usually a bad idea, but fine for a simple program like this
    
    // bool variable to keep the game running
    bool gameRunning = false;
    
    // a pointer to an allegro display object
    ALLEGRO_DISPLAY *pDisplay = null;
    
    // a pointer to an allegro font object
    ALLEGRO_FONT *pFont = null;
    
    int gameWidth = 640;
    int gameHeight = 480;
    
    const char* textToDisplay = "WOW! Your first Allegro program, cool!";
    
    const char* fontFilename = "CBM.ttf";
    int fontSize = 72;
    int fontFlags = 0;
    
    
    int main(int argc, char **argv)
    {
    	// attempt initialisation
    	if(init_allegro())
    	{
    		// if success
    		gameRunning = true;
    	}
    	
    	while(gameRunning)
    	{
    		update_display();
    	}
    	
    	cleanup();
    	return 0;
    }
    
    // define the functions
    bool init_allegro()
    {
    	if(!al_init() || !al_init_font_addon() || !al_init_ttf_addon())
    	{
    		allegro_message("Failed to init game! : " + allegro_error);
    		return false;
    	}
    	   
    	pDisplay = al_create_display(gameWidth, gameHeight);
    
    	if(pDisplay == null)
    	{
    		allegro_message("Failed to create display! : " + allegro_error);
    		return false;
    	}
    	   
    	pFont = al_load_ttf_font(fontFilename, fontSize, fontFlags);
    	if(pFont == null)
    	{
    		allegro_message("Failed to create font! : " + allegro_error);
    		return false;
    	}
    	
    	return true;
    }
    
    void update_display()
    {
    	// clear to chosen colour
    	al_clear_to_color(al_map_rgb(40,20,60));
    	
    	// draw some text
    	al_draw_text(font, al_map_rgb(255,210, 100), 640/2, (480/4),ALLEGRO_ALIGN_CENTRE,textToDisplay);
    
    	// show the text
    	al_flip_display();
    
    	// rest 10 seconds
    	al_rest(10.0);
    }
    
    void cleanup()
    {
    	// destroy anything we created
    	if(pDisplay != null)
    	{
    		al_destroy_display(pDisplay);
    	}
    	
    	if(pFont != null)
    	{
    		al_destroy_font(pFont);
    	}
    }
    
    


    This will of course run forever and will probably need a force quit. I'll leave that for you to create a more elegant implementation ;)/>
  5. In Topic: allegro file difficulty...

    Posted 17 Jun 2015

    I was confused as to why you were including the same header files more than once?

    Also your code has no way to continue executing, it just loads the font does one display and then exits.

    You need to wrap what you want to continue executing in a loop:

    if(!gameFinished)
    {
       // continue executing game code
    }
    
    // game finished - destroy anything you created
    return 0;
    
    

My Information

Member Title:
フカユ
Age:
30 years old
Birthday:
September 1, 1984
Gender:
Location:
Hexham, UK
Interests:
Video Games, Coding Video Games, Playing Guitar, Newcastle United, Black Label Society
Forum Leader:
Game Programming, Graphic Design
Years Programming:
5
Programming Languages:
C++, Flash Actionscript, HLSL

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  stayscrispinmilk

Comments

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  1. Photo

    IanKoro Icon

    24 Apr 2015 - 08:26
    Hi, I don't know if you'll see this, but I was going through your SDL game tutorial, and on part 5 you direct people to this snippet to get a Singleton class:
    http://www.dreamincode.net/code/snippet5421.htm
    Only the link is dead now. Any idea where I can find the same code?
  2. Photo

    Michael26 Icon

    01 Oct 2013 - 15:23
    No, THIS IS MADNESS
  3. Photo

    aaron1178 Icon

    08 Aug 2013 - 03:56
    THIS.IS.SPAM wait,
    THIS.IS.SPAWN, no.
    THIS.IS.SPARTA, yes.
  4. Photo

    raspinudo Icon

    08 Jul 2013 - 01:30
    Congratulations on the book!
  5. Photo

    Deutschmark Icon

    18 Jun 2013 - 07:29
    Hello Stayscrisp, am a 3D artist and in need of some help as am looking for a C++ programmer, I was wondering if we could take this to e-mail please and I can let you know what it is all about, my e-mail is; john ( at ) modelartbymarco ( dot ) com
  6. Photo

    Deutschmark Icon

    18 Jun 2013 - 07:29
    Hello Stayscrisp, am a 3D artist and in need of some help as am looking for a C++ programmer, I was wondering if we could take this to e-mail please and I can let you know what it is all about, my e-mail is; john ( at ) modelartbymarco ( dot ) com
  7. Photo

    aaron1178 Icon

    03 Apr 2013 - 01:48
    Hey Stayscrisp, hows it going? also what ever happened to serapth? or however you spell it :p I went away for a month or two and he was no longer a game dev forum leader
  8. Photo

    raghav.naganathan Icon

    27 Dec 2012 - 20:46
    Dude...congrats on the signature contest...and congrats on the perfect square rep(900) as well :)
  9. Photo

    PabloSimo Icon

    28 Jan 2012 - 23:56
    Stayscrispinmilk, hows it going? your a hard person to find
  10. Photo

    civicdude95 Icon

    19 Jan 2012 - 09:48
    Hey crisp, you should make some more sdl tutorials. The old ones are great and I'm sure people would love to see more of them!
  11. Photo

    trevster344 Icon

    06 Jan 2012 - 10:44
    Keep up the good work!
  12. Photo

    sidwwegame Icon

    01 Jan 2012 - 06:32
    HEY PLZZZ HELP ME TO MAKE c++ coding on cash counter.......PLZZZ SEND ME A CODING ....
  13. Photo

    aaron1178 Icon

    26 Aug 2011 - 01:40
    You wouldn't happen to know If or When forum leaders are next chosen would you? and hows mod life :]
  14. Photo

    aaron1178 Icon

    10 Aug 2011 - 01:17
    I miss you over at the Game Programming forum :Sob: its so inactive these days haha but congrats
  15. Photo

    gabehabe Icon

    27 Jul 2011 - 10:25
    Only made it yesterday morning... I feel my office productivity level is high. ;)
  • (3 Pages)
  • +
  • 1
  • 2
  • 3