aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-26 07:00:58 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-02-26 07:00:58 +0000
commita265788184832a725213c0fc87372c7df42146d1 (patch)
tree6ef43b4cc71b0c6f247732f3d1d0e87a9e558118
parent318eae8dadf86fe5b64697775ebea6ad7f748c96 (diff)
downloadusdx-a265788184832a725213c0fc87372c7df42146d1.tar.gz
usdx-a265788184832a725213c0fc87372c7df42146d1.tar.xz
usdx-a265788184832a725213c0fc87372c7df42146d1.zip
added patch to toggle full screen with F11
( and tried Alt Enter. but not working yet ) also did some investigation into SDL Video modes on linux note this bug : https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/14044 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@888 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/UIni.pas48
-rw-r--r--Game/Code/Classes/UMain.pas23
2 files changed, 57 insertions, 14 deletions
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas
index 4ac67cda..4de18ba3 100644
--- a/Game/Code/Classes/UIni.pas
+++ b/Game/Code/Classes/UIni.pas
@@ -190,7 +190,8 @@ var
I, I2, I3: integer;
S: string;
Modes: PPSDL_Rect;
- SR: TSearchRec; //Skin List Patch
+ SR: TSearchRec; //Skin List Patch
+ lFileName : String;
function GetFileName (S: String):String;
begin
@@ -201,14 +202,19 @@ var
begin
GamePath := Platform.GetGameUserPath;
+ Log.LogStatus( 'GamePath : ' +GamePath , '' );
+
if (Params.ConfigFile <> '') then
try
- IniFile := TMemIniFile.Create(Params.ConfigFile);
+ lFileName := Params.ConfigFile;
except
- IniFile := TMemIniFile.Create(GamePath + 'config.ini');
+ lFileName := GamePath + 'config.ini';
end
else
- IniFile := TMemIniFile.Create(GamePath + 'config.ini');
+ lFileName := GamePath + 'config.ini';
+
+ Log.LogStatus( 'Using config : ' +lFileName , '');
+ IniFile := TMemIniFile.Create( lFileName );
// Name
@@ -273,19 +279,37 @@ begin
// Resolution
SetLength(IResolution, 0);
- Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available
- while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07)
- begin
- SetLength(IResolution, Length(IResolution) + 1);
- IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h);
- Inc(Modes);
- end;
+ Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_RESIZABLE ) ; // Check if there are any modes available
+// Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN or SDL_RESIZABLE); // Check if there are any modes available
+ if integer( Modes ) = 0 then
+ begin
+ Log.LogStatus( 'No resolutions Found' , 'Video');
+ end
+ else
+ if integer( Modes ) = -1 then
+ begin
+ Log.LogStatus( 'ANY resolutions can be used' , 'Video');
+ // Interesting bug here on linux ...
+ // https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/14044
+ end
+ else
+ begin
+ while assigned( Modes^ ) do //this should solve the biggest wine problem | THANKS Linnex (11.11.07)
+ begin
+ Log.LogStatus( 'Found Video Mode : ' + IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h) , 'Video');
+ SetLength(IResolution, Length(IResolution) + 1);
+ IResolution[High(IResolution)] := IntToStr(Modes^.w) + 'x' + IntToStr(Modes^.h);
+ Inc(Modes);
+ end;
+ end;
+
// if no modes were set, then failback to 800x600
// as per http://sourceforge.net/forum/message.php?msg_id=4544965
// THANKS : linnex at users.sourceforge.net
if Length(IResolution) < 1 then
- begin
+ begin
+ Log.LogStatus( 'Found Video Mode : NONE !!! ( Defaulted to 800 x 600 )', 'Video');
SetLength(IResolution, Length(IResolution) + 1);
IResolution[High(IResolution)] := IntToStr(800) + 'x' + IntToStr(600);
Log.LogStatus('SDL_ListModes Defaulted Res To : ' + IResolution[High(IResolution)] , 'Graphics - Resolutions');
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 6f336c50..12cd783c 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -456,11 +456,30 @@ Begin
// remap the "keypad enter" key to the "standard enter" key
if (Event.key.keysym.sym = SDLK_KP_ENTER) then
Event.key.keysym.sym := SDLK_RETURN;
+
+ if (Event.key.keysym.sym = SDLK_F11 ) (*OR
+ (Event.key.keysym.sym = KMOD_ALT and SDLK_RETURN )*)then // toggle full screen
+ begin
+ writeln( 'Toggle FullScreen' );
+ Ini.FullScreen := integer( not boolean( Ini.FullScreen ) );
+
+ if boolean( Ini.FullScreen ) then
+ begin
+ SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN);
+ SDL_ShowCursor(0);
+ end
+ else
+ begin
+ SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE);
+ SDL_ShowCursor(1);
+ end;
+
+ glViewPort(0, 0, 1600, 1200);
+ end;
//ScreenShot hack. If Print is pressed-> Make screenshot and Save to Screenshots Path
if (Event.key.keysym.sym = SDLK_SYSREQ) or (Event.key.keysym.sym = SDLK_PRINT) then
- Display.ScreenShot
-
+ Display.ScreenShot
// popup hack... if there is a visible popup then let it handle input instead of underlying screen
// shoud be done in a way to be sure the topmost popup has preference (maybe error, then check)
else if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then