•      Sign In
• Create Account

### #Actualshacktar

Posted 08 March 2013 - 10:49 PM

Your globals point to locations in memory, however those locations I believe pass out of scope at the end of the function.

That part appears to be fine. Background and Image are set with LoadImage which returns a heap-allocated pointer. SDL_FreeSurface is necessary to free the loaded images (used correctly in Cleanup()).

//load the image
if(LoadFiles == false)
{
return 1;
}


Here, you're not actually calling LoadFiles (the brackets are missing). Instead, this code is checking if the function pointer LoadFiles is false i.e. zero, which it isn't of course as it's a valid function.

### #1shacktar

Posted 08 March 2013 - 10:46 PM

Your globals point to locations in memory, however those locations I believe pass out of scope at the end of the function.

That part appears to be fine. Background and Image are set with LoadImage which returns a heap-allocated pointer. SDL_FreeSurface is necessary to free the loaded images (used correctly in Cleanup()).

//load the image
if(LoadFiles == false)
{
return 1;
}


Here, you're not actually calling LoadFiles (the brackets are missing). Instead, this code is checking if the function pointer LoadFiles is false i.e. zero, which it isn't of course as it's a valid funciton.

PARTNERS