Archived

This topic is now archived and is closed to further replies.

stooge_dev

drawing using SDL

Recommended Posts

Im trying to create a game using SDL and when I use Full Screen mode nothing that I draw shows on screen. If I use Windowed mode graphics are drawn. Here''s the video mode I''m setting: screen=SDL_SetVideoMode(640,480,16,SDL_SWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN); main loop:
  
  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:
  
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);	
}
  

Share this post


Link to post
Share on other sites
Off the top of my head, try SDL_Flip(screen), although I thought UpdateRect should do the same, it''s something to try.

Share this post


Link to post
Share on other sites
Thanks. Using SDL_Flip solved the problem for now. I was using it before and thought I had the same problem. Then I decided to use SDL_UpdateRect instead. Maybe I need both?

Share this post


Link to post
Share on other sites