Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - REV2K7

Pages: [1] 2 3 ... 23
1
Coding / [XNA] help
« on: October 04, 2011, 08:06:50 pm »
I am going over code that i wrote for this book about xna. My problem is i got stars running in background that works fine , i added asteroids they worked but i put in code to make them bounce if collided now they do not display at all i cant figure it out at all.

source code
heres link to my source

2
Coding / Re: [SDL] Tutorial help
« on: May 30, 2011, 03:03:12 am »
i am gonna look into it , i got alot RL !@#$% going on at same time so its hard getting time i just got off from  9hr shift.

3
Coding / Re: [SDL] Tutorial help
« on: May 28, 2011, 04:21:40 am »
i think i must just made that error tight butthole i swear it wasnt there before u can check in copy code on post 1 lol T_T

4
Coding / Re: [SDL] Tutorial help
« on: May 28, 2011, 03:15:25 am »
did it same error returns 2 meaning its load_file() i am guessing.

5
Coding / Re: [SDL] Tutorial help
« on: May 28, 2011, 01:39:33 am »
okay thanks.

6
Coding / Re: [SDL] Tutorial help
« on: May 28, 2011, 01:31:29 am »

7
Coding / Re: [SDL] Tutorial help
« on: May 27, 2011, 09:18:58 pm »
its in the directory.

8
Coding / Re: [SDL] Tutorial help
« on: May 27, 2011, 02:38:46 am »
no i know your trying to help.i went in the linker settings -> debuggin generate debug info is set to true.

i just switched the returns to different numbers it returned 2 and this is portion of code that must be faulty

Code: [Select]
bool load_files()
{
    //Load the background image
    background = load_image( "background.png" );

    //Open the font
    font = TTF_OpenFont( "lazy.ttf", 72 );

    //If there was a problem in loading the background
    if( background == NULL )
    {
        return false;
    }

    //If there was an error in loading the font
    if( font == NULL )
    {
        return false;
    }

    //If everything loaded fine
    return true;
}

9
Coding / Re: [SDL] Tutorial help
« on: May 27, 2011, 01:46:31 am »
yeah that what i was thinking i was just following the tutorial. @star i  debugged it , i am a beginner at C++.

this is error log
Code: [Select]
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\SDL_TUTORIAL.exe', Symbols loaded.
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\SDL.dll', Binary was not built with debug information.
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\SDL_image.dll', Binary was not built with debug information.
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\SDL_ttf.dll', Binary was not built with debug information.
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\libfreetype-6.dll', Binary was not built with debug information.
'SDL_TUTORIAL.exe': Loaded 'D:\Users\revix2k10\Documents\Visual Studio 2010\Projects\SDL_TUTORIAL\Debug\zlib1.dll', Binary was not built with debug information.
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Symbols loaded.
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded.
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\ddraw.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\dwmapi.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\setupapi.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\devobj.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\oleaut32.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\dciman32.dll'
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\KBDUS.DLL', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL'
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'SDL_TUTORIAL.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x304) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1a14) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1814) has exited with code 1 (0x1).
The program '[5176] SDL_TUTORIAL.exe: Native' has exited with code 1 (0x1).

10
Coding / Re: [SDL] Tutorial help
« on: May 26, 2011, 04:06:32 pm »
i tried running it with visual C++ 2010 with debug it crashes at start up. I just went over the code , with the lesson copy and its like 1:1 except he ad font bigger and color of font was different.


Code: [Select]
/*This source code copyrighted by Lazy Foo' Productions (2004-2011)
and may not be redestributed without written permission.*/

//The headers
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include <string>

//Screen attributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

//The surfaces
SDL_Surface *background = NULL;
SDL_Surface *upMessage = NULL;
SDL_Surface *downMessage = NULL;
SDL_Surface *leftMessage = NULL;
SDL_Surface *rightMessage = NULL;
SDL_Surface *message = NULL;
SDL_Surface *screen = NULL;

//The event structure
SDL_Event event;

//The font
TTF_Font *font = NULL;

//The color of the font
SDL_Color textColor = { 0, 0, 0 };

SDL_Surface *load_image( std::string filename )
{
    //The image that's loaded
    SDL_Surface* loadedImage = NULL;

    //The optimized surface that will be used
    SDL_Surface* optimizedImage = NULL;

    //Load the image
    loadedImage = IMG_Load( filename.c_str() );

    //If the image loaded
    if( loadedImage != NULL )
    {
        //Create an optimized surface
        optimizedImage = SDL_DisplayFormat( loadedImage );

        //Free the old surface
        SDL_FreeSurface( loadedImage );

        //If the surface was optimized
        if( optimizedImage != NULL )
        {
            //Color key surface
            SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }

    //Return the optimized surface
    return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    //Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = x;
    offset.y = y;

    //Blit
    SDL_BlitSurface( source, clip, destination, &offset );
}

bool init()
{
    //Initialize all SDL subsystems
    if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
    {
        return false;
    }

    //Set up the screen
    screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );

    //If there was an error in setting up the screen
    if( screen == NULL )
    {
        return false;
    }

    //Initialize SDL_ttf
    if( TTF_Init() == -1 )
    {
        return false;
    }

    //Set the window caption
    SDL_WM_SetCaption( "Press an Arrow Key", NULL );

    //If everything initialized fine
    return true;
}

bool load_files()
{
    //Load the background image
    background = load_image( "background.png" );

    //Open the font
    font = TTF_OpenFont( "lazy.ttf", 72 );

    //If there was a problem in loading the background
    if( background == NULL )
    {
        return false;
    }

    //If there was an error in loading the font
    if( font == NULL )
    {
        return false;
    }

    //If everything loaded fine
    return true;
}

void clean_up()
{
    //Free the surfaces
    SDL_FreeSurface( background );
    SDL_FreeSurface( upMessage );
    SDL_FreeSurface( downMessage );
    SDL_FreeSurface( leftMessage );
    SDL_FreeSurface( rightMessage );

    //Close the font
    TTF_CloseFont( font );

    //Quit SDL_ttf
    TTF_Quit();

    //Quit SDL
    SDL_Quit();
}

int main( int argc, char* args[] )
{
    //Quit flag
    bool quit = false;

    //Initialize
    if( init() == false )
    {
        return 1;
    }

    //Load the files
    if( load_files() == false )
    {
        return 1;
    }

    //Generate the message surfaces
    upMessage = TTF_RenderText_Solid( font, "Up was pressed.", textColor );
    downMessage = TTF_RenderText_Solid( font, "Down was pressed.", textColor );
    leftMessage = TTF_RenderText_Solid( font, "Left was pressed", textColor );
    rightMessage = TTF_RenderText_Solid( font, "Right was pressed", textColor );

    //Apply the background
    apply_surface( 0, 0, background, screen );

    //While the user hasn't quit
    while( quit == false )
    {
        //If there's an event to handle
        if( SDL_PollEvent( &event ) )
        {
            //If a key was pressed
            if( event.type == SDL_KEYDOWN )
            {
                //Set the proper message surface
                switch( event.key.keysym.sym )
                {
                    case SDLK_UP: message = upMessage; break;
                    case SDLK_DOWN: message = downMessage; break;
                    case SDLK_LEFT: message = leftMessage; break;
                    case SDLK_RIGHT: message = rightMessage; break;
                }
            }

            //If the user has Xed out the window
            else if( event.type == SDL_QUIT )
            {
                //Quit the program
                quit = true;
            }
        }

        //If a message needs to be displayed
        if( message != NULL )
        {
            //Apply the background to the screen
            apply_surface( 0, 0, background, screen );

            //Apply the message centered on the screen
            apply_surface( ( SCREEN_WIDTH - message->w ) / 2, ( SCREEN_HEIGHT - message->h ) / 2, message, screen );

            //Null the surface pointer
            message = NULL;
        }

        //Update the screen
        if( SDL_Flip( screen ) == -1 )
        {
            return 1;
        }
    }

    //Clean up
    clean_up();

    return 0;
}
this is lesson source code it works i cant figure out what i did wrong?

11
Coding / Re: [SDL] Tutorial help
« on: May 26, 2011, 07:19:10 am »
yes

12
Coding / [SDL] Tutorial help
« on: May 26, 2011, 05:28:51 am »
i am doing lazy foos tutorial , and i cant figure out why the text wont draw and it crashes at startup.

Code: [Select]
/*This source code copyrighted by Lazy Foo' Productions (2004-2011)
and may not be redestributed without written permission.*/

//The headers
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include <string>

//Screen attributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

//The surfaces
SDL_Surface *background = NULL;
SDL_Surface *upMessage = NULL;
SDL_Surface *downMessage = NULL;
SDL_Surface *leftMessage = NULL;
SDL_Surface *rightMessage = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *message = NULL;

//The event structure
SDL_Event event;

//The font that's going to be used
TTF_Font *font = NULL;

//The color of the font
SDL_Color textColor = { 255, 255, 255 };

SDL_Surface *load_image( std::string filename )
{
    //The image that's loaded
    SDL_Surface* loadedImage = NULL;

    //The optimized surface that will be used
    SDL_Surface* optimizedImage = NULL;

    //Load the image
    loadedImage = IMG_Load( filename.c_str() );

    //If the image loaded
    if( loadedImage != NULL )
    {
        //Create an optimized surface
        optimizedImage = SDL_DisplayFormat( loadedImage );

        //Free the old surface
        SDL_FreeSurface( loadedImage );

        //If the surface was optimized
        if( optimizedImage != NULL )
        {
            //Color key surface
            SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }

    //Return the optimized surface
    return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    //Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = x;
    offset.y = y;

    //Blit
    SDL_BlitSurface( source, clip, destination, &offset );
}

bool init()
{
    //Initialize all SDL subsystems
    if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
    {
        return false;
    }

    //Set up the screen
    screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );

    //If there was an error in setting up the screen
    if( screen == NULL )
    {
        return false;
    }

    //Initialize SDL_ttf
    if( TTF_Init() == -1 )
    {
        return false;
    }

    //Set the window caption
    SDL_WM_SetCaption( "TTF Test", NULL );

    //If everything initialized fine
    return true;
}

bool load_files()
{
    //Load the background image
    background = load_image( "background.png" );

    //Open the font
    font = TTF_OpenFont( "lazy.ttf", 28 );

    //If there was a problem in loading the background
    if( background == NULL )
    {
        return false;
    }

    //If there was an error in loading the font
    if( font == NULL )
    {
        return false;
    }

    //If everything loaded fine
    return true;
}

void clean_up()
{
    //Free the surfaces
    SDL_FreeSurface( background );
    SDL_FreeSurface( upMessage );
SDL_FreeSurface( downMessage);
SDL_FreeSurface( leftMessage);
SDL_FreeSurface( rightMessage);
    //Close the font that was used
    TTF_CloseFont( font );

    //Quit SDL_ttf
    TTF_Quit();

    //Quit SDL
    SDL_Quit();
}

int main( int argc, char* args[] )
{
    //Quit flag
    bool quit = false;

    //Initialize
    if( init() == false )
    {
        return 1;
    }

    //Load the files
    if( load_files() == false )
    {
        return 1;
    }

    //Render the text
    upMessage = TTF_RenderText_Solid( font, "up was pressed", textColor );
downMessage = TTF_RenderText_Solid( font,"down was pressed",textColor);
leftMessage = TTF_RenderText_Solid(font, "left was pressed",textColor);
rightMessage = TTF_RenderText_Solid(font, "right was pressed",textColor);
apply_surface(0,0,background,screen);
    //If there was an error in rendering the text
    if( message == NULL )
    {
        return 1;
    }


    //Apply the images to the screen
   
   
    //While the user hasn't quit
    while( quit == false )
    {
        //While there's events to handle
        while( SDL_PollEvent( &event ) )
        {
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_UP : message = upMessage; break;
case SDLK_DOWN : message = downMessage; break;
case SDLK_LEFT : message = leftMessage; break;
case SDLK_RIGHT : message = rightMessage; break;
}

}
            //If the user has Xed out the window
else if( event.type == SDL_QUIT )
            {
                //Quit the program
                quit = true;
            }
        }
    }


if (message != NULL)
{
apply_surface( 0, 0, background, screen );
apply_surface((SCREEN_WIDTH - message->w) / 2, (SCREEN_HEIGHT - message->h) / 2, message,screen);

message = NULL;

}

//Update the screen
    if( SDL_Flip( screen ) == -1 )
    {
        return 2;
    }


    //Free surfaces and font then quit SDL_ttf and SDL
    clean_up();

    return 0;
}
/*This source code copyrighted by Lazy Foo' Productions (2004-2011)
and may not be redestributed without written permission.*/

//The headers
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include <string>

//Screen attributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

//The surfaces
SDL_Surface *background = NULL;
SDL_Surface *upMessage = NULL;
SDL_Surface *downMessage = NULL;
SDL_Surface *leftMessage = NULL;
SDL_Surface *rightMessage = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *message = NULL;

//The event structure
SDL_Event event;

//The font that's going to be used
TTF_Font *font = NULL;

//The color of the font
SDL_Color textColor = { 255, 255, 255 };

SDL_Surface *load_image( std::string filename )
{
    //The image that's loaded
    SDL_Surface* loadedImage = NULL;

    //The optimized surface that will be used
    SDL_Surface* optimizedImage = NULL;

    //Load the image
    loadedImage = IMG_Load( filename.c_str() );

    //If the image loaded
    if( loadedImage != NULL )
    {
        //Create an optimized surface
        optimizedImage = SDL_DisplayFormat( loadedImage );

        //Free the old surface
        SDL_FreeSurface( loadedImage );

        //If the surface was optimized
        if( optimizedImage != NULL )
        {
            //Color key surface
            SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }

    //Return the optimized surface
    return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    //Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = x;
    offset.y = y;

    //Blit
    SDL_BlitSurface( source, clip, destination, &offset );
}

bool init()
{
    //Initialize all SDL subsystems
    if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
    {
        return false;
    }

    //Set up the screen
    screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );

    //If there was an error in setting up the screen
    if( screen == NULL )
    {
        return false;
    }

    //Initialize SDL_ttf
    if( TTF_Init() == -1 )
    {
        return false;
    }

    //Set the window caption
    SDL_WM_SetCaption( "TTF Test", NULL );

    //If everything initialized fine
    return true;
}

bool load_files()
{
    //Load the background image
    background = load_image( "background.png" );

    //Open the font
    font = TTF_OpenFont( "lazy.ttf", 28 );

    //If there was a problem in loading the background
    if( background == NULL )
    {
        return false;
    }

    //If there was an error in loading the font
    if( font == NULL )
    {
        return false;
    }

    //If everything loaded fine
    return true;
}

void clean_up()
{
    //Free the surfaces
    SDL_FreeSurface( background );
    SDL_FreeSurface( upMessage );
SDL_FreeSurface( downMessage);
SDL_FreeSurface( leftMessage);
SDL_FreeSurface( rightMessage);
    //Close the font that was used
    TTF_CloseFont( font );

    //Quit SDL_ttf
    TTF_Quit();

    //Quit SDL
    SDL_Quit();
}

int main( int argc, char* args[] )
{
    //Quit flag
    bool quit = false;

    //Initialize
    if( init() == false )
    {
        return 1;
    }

    //Load the files
    if( load_files() == false )
    {
        return 1;
    }

    //Render the text
    upMessage = TTF_RenderText_Solid( font, "up was pressed", textColor );
downMessage = TTF_RenderText_Solid( font,"down was pressed",textColor);
leftMessage = TTF_RenderText_Solid(font, "left was pressed",textColor);
rightMessage = TTF_RenderText_Solid(font, "right was pressed",textColor);
apply_surface(0,0,background,screen);
    //If there was an error in rendering the text
    if( message == NULL )
    {
        return 1;
    }


    //Apply the images to the screen
   
   
    //While the user hasn't quit
    while( quit == false )
    {
        //While there's events to handle
        while( SDL_PollEvent( &event ) )
        {
if (event.type == SDL_KEYDOWN)
{
switch(event.key.keysym.sym)
{
case SDLK_UP : message = upMessage; break;
case SDLK_DOWN : message = downMessage; break;
case SDLK_LEFT : message = leftMessage; break;
case SDLK_RIGHT : message = rightMessage; break;
}

}
            //If the user has Xed out the window
else if( event.type == SDL_QUIT )
            {
                //Quit the program
                quit = true;
            }
        }
    }


if (message != NULL)
{
apply_surface( 0, 0, background, screen );
apply_surface((SCREEN_WIDTH - message->w) / 2, (SCREEN_HEIGHT - message->h) / 2, message,screen);

message = NULL;

}

//Update the screen
    if( SDL_Flip( screen ) == -1 )
    {
        return 2;
    }


    //Free surfaces and font then quit SDL_ttf and SDL
    clean_up();

    return 0;
}


Quote
The thread 'Win32 Thread' (0x958) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1464) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1674) has exited with code 1 (0x1).
The program '[5680] SDL_TUTORIAL.exe: Native' has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x958) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1464) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1674) has exited with code 1 (0x1).
The program '[5680] SDL_TUTORIAL.exe: Native' has exited with code 1 (0x1).

13
Entertainment / Legend of Zelda - 25th Birthday
« on: February 21, 2011, 01:48:41 pm »

14
Entertainment / Re: The New Super Mario Brothers Wii demo is now online
« on: November 18, 2009, 05:20:19 am »
i hate peta , good view on em on south park episode where they marry animals in there own lil congregation and on spokes person pamela anderson we all know shes just a dumb !@#$% with big fake boobs.

15
Entertainment / Re: Nintendo has found an even better way to stop DS Piracy
« on: November 18, 2009, 05:18:36 am »
No worries, AC 2 DS runs on my acekart 2, it's fun :D

also, i'm prety sure every card in the world runs the japanese version of HG/SS so the English version will be fine
my freaking acekard 2 sucks i got defunct one it shuts off randomly :( lucky

16
Discussion / Re: Making a game after the Oot ?
« on: November 18, 2009, 05:16:27 am »
i can guess that it wont end in 1 year  :P

17
Discussion / Re: Making a game after the Oot ?
« on: November 17, 2009, 08:51:55 am »
meh i was only trying to help him realize that this a giant task.

18
Discussion / Re: Making a game after the Oot ?
« on: November 16, 2009, 10:30:37 am »
sp you know that all games that succed are planned on paper first or at least on e-paper(pc joke lawl) you got plan your game i know from experience that your going to fail its ok as long as you learn something  8)

19
Discussion / Re: Making a game after the Oot ?
« on: November 15, 2009, 02:00:46 am »
so making a stick means your serious ? no offense but i know your gonna fail. You should try and do something original and in 2d.

20
Entertainment / Re: Borderlands
« on: October 22, 2009, 08:19:58 pm »
im gonna get it for PC !

Pages: [1] 2 3 ... 23

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 1.307 seconds with 35 queries.

anything