Need and SDL user's assistance
Feb 15, 2011 at 2:18am UTC
this code wont work for some reason. It compiles and executes but the only thing that shows up is a black screen. I put the BMP in the same file as the exe. but it still wont show up when the program runs. Here's the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#include <SDL.h>
#include <iostream>
int main(int argc, char * args[] )
{
//The images
SDL_Surface *screen = NULL;
SDL_Surface *image = NULL;
//Start SDL
SDL_Init (SDL_INIT_EVERYTHING);
//Set Screen
screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
//Load image
image = SDL_LoadBMP("hello.bmp" );
//Apply to Screen
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen);
SDL_Delay(2000);
SDL_FreeSurface(image);
//Quit SDL
SDL_Quit();
return 0;
}
Feb 15, 2011 at 4:15pm UTC
Please stop posting the same question on multiple threads. It's very confusing to the people trying to help you.
Topic archived. No new replies allowed.