problems blitting a picture to the screen
When I try to blit a .bmp picture to the screen, just a black screen shows up.
I've used SDL_LoadBMP(), SDL_BlitSurface(), and SDL_UpdateRect(), but it doesn't work. Any tips?
I've used SDL_LoadBMP(), SDL_BlitSurface(), and SDL_UpdateRect(), but it doesn't work. Any tips?
My error tells me that it can't open the file.
Here's the code...
SDL_Surface *image;
image = SDL_LoadBMP("one.bmp");
if (image == NULL)
{
fprintf(stderr, "Couldn't load %s: %s\n", "one.bmp", SDL_GetError());
}
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen);
SDL_FreeSurface(image);
Here's the code...
SDL_Surface *image;
image = SDL_LoadBMP("one.bmp");
if (image == NULL)
{
fprintf(stderr, "Couldn't load %s: %s\n", "one.bmp", SDL_GetError());
}
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen);
SDL_FreeSurface(image);
Is the file one.bmp in the same folder as your app? (The "build" folder, if you used Xcode).
SDL sets the default directory to the same folder as your app package, not to the Resources folder inside it (Check SDLMain.m if you want to change that)
SDL sets the default directory to the same folder as your app package, not to the Resources folder inside it (Check SDLMain.m if you want to change that)
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL full screen mode leaves garbage on screen when exiting app | Malarkey | 5 | 4,454 |
Nov 19, 2008 12:51 PM Last Post: Malarkey |
|
| picture before app ? | imaumac | 4 | 2,346 |
Nov 1, 2008 07:37 AM Last Post: imaumac |
|
| picture for some seconds | imaumac | 3 | 1,809 |
Oct 23, 2008 09:28 PM Last Post: kodex |
|
| SDL Blitting | KidTsunami | 5 | 5,833 |
May 8, 2008 08:17 AM Last Post: leRiCl |
|
| NSGL full screen problems | Josh | 2 | 2,813 |
Jan 19, 2005 04:02 AM Last Post: Josh |
|

