-
drawing using SDL
I'm trying to create a game using SDL and when using Full Screen mode my graphics don't show on the screen, but in Windowed mode they do.
Here's the type of video mode I'm setting:
screen=SDL_SetVideoMode(640,480,16,SDL_SWSURFACE|S DL_DOUBLEBUF|SDL_FULLSCREEN);
main loop:
Code:
while(done == 0)
{
SDL_Event event;
while ( SDL_PollEvent(&event) )
{
if ( event.type == SDL_QUIT ) { done = 1; }
if ( event.type == SDL_KEYDOWN )
{
if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; }
if ( event.key.keysym.sym == SDLK_SYSREQ ) { savescreen(screen); }
}
}
DrawScene(screen);
}
drawScreen:
Code:
void DrawScene(SDL_Surface *screen)
{
int x, y;
SDL_Rect rectTitle;
rectTitle.x = 0;
rectTitle.y = 0;
rectTitle.w = 640;
rectTitle.h = 480;
Slock(screen);
// SDL_BlitSurface(title, &rectTitle, screen, NULL);
hline(screen,0,0,640,255,0,0);
Sulock(screen);
SDL_UpdateRect(screen,0,0,0,0);
}
-
-
What's the matter, kid? How come no ones attempting to help?
-
ok, let me get this straight, you can see the stuff when the app is in windowed, but when you switch to fullscreen everything disappears, so, what happens when you switch back.
are you using OpenGL?
im going on a hunch since i dont use SDL.
-
Use flipping
Since you're using SDL_DOUBLEBUF, I would use
SDL_Flip(screen);
intstead of
SDL_UpdateRect(screen, 0, 0, 0, 0);
You have to use SDL_Flip when using double buffering.
-
No, I'm not using any of OpenGL. Now I understand why I was told to use SDL_Flip before. I thought the manual meant that it was the same as SDL_Update. Thanks for the help.