drawing using SDL

This is a discussion on drawing using SDL within the Game Programming forums, part of the General Programming Boards category; I'm trying to create a game using SDL and when using Full Screen mode my graphics don't show on the ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    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);	
    }

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Forgot the source.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    What's the matter, kid? How come no ones attempting to help?

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    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.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    Registered User PotitKing's Avatar
    Join Date
    Dec 2001
    Posts
    28

    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.
    % gcc -v
    Configured with: FreeBSD/i386 system compiler
    Thread model: posix
    gcc version 3.3.3 [FreeBSD] 20031106

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems compiling this SDL app
    By Rider in forum C++ Programming
    Replies: 3
    Last Post: 03-27-2007, 01:22 PM
  2. SDL and MinGW Studio
    By Vicious in forum Tech Board
    Replies: 0
    Last Post: 07-30-2004, 10:59 PM
  3. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 01:19 AM
  4. DirectX or SDL?
    By Leeman_s in forum Game Programming
    Replies: 2
    Last Post: 01-19-2003, 10:13 PM
  5. sdl in c++
    By Klinerr1 in forum C++ Programming
    Replies: 8
    Last Post: 07-07-2002, 08:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21