Results 1 to 3 of 3

Thread: Leaving fullscreen mode in Windows

  1. #1

    Leaving fullscreen mode in Windows

    My desktop resolution is 1280x1024. I use SDL_SetVideoMode with fullscreen flag to enter fullscreen mode (800x600) and that works fine. When I try to exit fullscreen mode (calling SDL_SetVideoMode without fullscreen flag) my desktop resolution isn't restored... it's still 800x600.

    How can I exit fullscreen mode properly?

  2. #2

    Leaving fullscreen mode in Windows

    Try something like this (pulled straight from JumpStart so it should work)

    Code:
    var
      videoFlags   : UInt32;
      videoInfo    : PSDL_VideoInfo;
    
    procedure InitRenderInfo;
    begin
      if SDL_Init&#40; SDL_INIT_VIDEO &#41; <> 0 then
        halt;
      InitSoundEngine;
      CreateScriptEngine;
      videoInfo &#58;= SDL_GetVideoInfo;
      if videoInfo = nil then
        halt;
    
      videoFlags &#58;= videoFlags or SDL_DOUBLEBUF; // Enable double buffering
      videoFlags &#58;= videoFlags or SDL_HWPALETTE; // Store the palette in hardware
    
      // This checks to see if surfaces can be stored in memory
      if &#40;videoInfo^.hw_available <> 0&#41; then
        videoFlags &#58;= videoFlags or SDL_HWSURFACE
      else
        videoFlags &#58;= videoFlags or SDL_SWSURFACE;
    
      // This checks if hardware blits can be done * /
      if &#40;videoInfo^.blit_hw <> 0&#41; then
        videoFlags &#58;= videoFlags or SDL_HWACCEL;
    end;
    
    procedure SetVideoMode&#40;Width, Height, BPP &#58; Integer; FullScreen &#58; Boolean&#41;;
    begin
      if FullScreen then
        videoFlags &#58;= videoFlags or SDL_FULLSCREEN
      else
        videoFlags &#58;= videoFlags and &#40;not SDL_FULLSCREEN&#41;;
      if Screen <> nil then
        SDL_FreeSurface&#40; Screen &#41;;
      Screen &#58;= SDL_SetVideoMode&#40; Width, Height, BPP, videoFlags &#41;;
    end;

  3. #3

    Leaving fullscreen mode in Windows

    Thanks... I was missing SDL_FreeSurface in my code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •