- Joined
- Aug 2, 2008
- Messages
- 1,315
Hello,
I need a help of someone who is comfortable around C++ and preferably SDL.
I'm trying to learn my way around C++ using Windows (sigh, would've used Kubuntu but it has some sort of grudge against my DVD-drive) and Visual C++ 2008 Express Edition.
The problem? The program gives no error regarding the code, none what so ever, but it does not load the image. It draws the screen black but displays no image and yes the image is in the right folder. When I execute it from the command line, it works perfectly. I think the debug-mode messes up the filepaths, any way to fix it?
Code:
May or may not count as a tech-issue but still, no better place to put it in.
I need a help of someone who is comfortable around C++ and preferably SDL.
I'm trying to learn my way around C++ using Windows (sigh, would've used Kubuntu but it has some sort of grudge against my DVD-drive) and Visual C++ 2008 Express Edition.
The problem? The program gives no error regarding the code, none what so ever, but it does not load the image. It draws the screen black but displays no image and yes the image is in the right folder. When I execute it from the command line, it works perfectly. I think the debug-mode messes up the filepaths, any way to fix it?
Code:
Code:
#include "SDL.h"
int main( int argc, char* args[] )
{
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
//Load image
hello = SDL_LoadBMP( "hello.bmp" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );
//Update Screen
SDL_Flip( screen );
//Pause
SDL_Delay( 2000 );
//Free the loaded image
SDL_FreeSurface( hello );
//Quit SDL
SDL_Quit();
return 0;
}
May or may not count as a tech-issue but still, no better place to put it in.
Last edited:










