View Full Version : Leaving fullscreen mode in Windows
Srki_82
30-01-2007, 10:43 PM
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?
jdarling
31-01-2007, 12:51 AM
Try something like this (pulled straight from JumpStart so it should work)
var
videoFlags : UInt32;
videoInfo : PSDL_VideoInfo;
procedure InitRenderInfo;
begin
if SDL_Init( SDL_INIT_VIDEO ) <> 0 then
halt;
InitSoundEngine;
CreateScriptEngine;
videoInfo := SDL_GetVideoInfo;
if videoInfo = nil then
halt;
videoFlags := videoFlags or SDL_DOUBLEBUF; // Enable double buffering
videoFlags := videoFlags or SDL_HWPALETTE; // Store the palette in hardware
// This checks to see if surfaces can be stored in memory
if (videoInfo^.hw_available <> 0) then
videoFlags := videoFlags or SDL_HWSURFACE
else
videoFlags := videoFlags or SDL_SWSURFACE;
// This checks if hardware blits can be done * /
if (videoInfo^.blit_hw <> 0) then
videoFlags := videoFlags or SDL_HWACCEL;
end;
procedure SetVideoMode(Width, Height, BPP : Integer; FullScreen : Boolean);
begin
if FullScreen then
videoFlags := videoFlags or SDL_FULLSCREEN
else
videoFlags := videoFlags and (not SDL_FULLSCREEN);
if Screen <> nil then
SDL_FreeSurface( Screen );
Screen := SDL_SetVideoMode( Width, Height, BPP, videoFlags );
end;
Srki_82
31-01-2007, 10:58 AM
Thanks... I was missing SDL_FreeSurface in my code.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.