Jump to content
  • Advertisement

Archived

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

stooge_dev

drawing using SDL

This topic is 5645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!