--- a/hedgewars/PascalExports.pas Tue Sep 20 16:00:20 2011 -0400
+++ b/hedgewars/PascalExports.pas Tue Sep 20 23:43:52 2011 +0200
@@ -36,7 +36,6 @@
implementation
{$IFDEF HWLIBRARY}
var cZoomVal: GLfloat;
- previousGameState: TGameState;
// retrieve protocol information
procedure HW_versionInfo(netProto: PLongInt; versionStr: PPChar); cdecl; export;
@@ -185,17 +184,6 @@
exit( isPaused );
end;
-procedure HW_suspend; cdecl; export;
-begin
- previousGameState:= GameState;
- GameState:= gsSuspend;
-end;
-
-procedure HW_resume; cdecl; export;
-begin
- GameState:= previousGameState;
-end;
-
// equivalent to esc+y; when closeFrontend = true the game exits after memory cleanup
procedure HW_terminate(closeFrontend: boolean); cdecl; export;
begin
--- a/hedgewars/hwengine.pas Tue Sep 20 16:00:20 2011 -0400
+++ b/hedgewars/hwengine.pas Tue Sep 20 23:43:52 2011 +0200
@@ -154,6 +154,7 @@
{$WARNINGS ON}
var PrevTime, CurrTime: Longword;
prevFocusState: boolean;
+ previousGameState: TGameState;
begin
PrevTime:= SDL_GetTicks;
while isTerminated = false do
@@ -175,6 +176,15 @@
begin
cHasFocus:= true;
onFocusStateChanged()
+ end
+ else if event.window.event = SDL_WINDOWEVENT_MINIMIZED then
+ begin
+ previousGameState:= GameState;
+ GameState:= gsSuspend;
+ end
+ else if event.window.event = SDL_WINDOWEVENT_RESTORED then
+ begin
+ GameState:= previousGameState;
end;
{$ELSE}
KeyPressChat(event.key.keysym.unicode);
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Tue Sep 20 16:00:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Tue Sep 20 23:43:52 2011 +0200
@@ -135,17 +135,10 @@
// true multitasking with sdl works only on 4.2 and above; we close the game to avoid a black screen at return
-(void) applicationWillResignActive:(UIApplication *)application {
- if (self.isInGame)
- if ([[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f)
+ if (self.isInGame && [[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f)
HW_terminate(NO);
- else
- HW_suspend();
+
[super applicationWillResignActive:application];
}
--(void) applicationDidBecomeActive:(UIApplication *)application {
- HW_resume();
- [super applicationDidBecomeActive:application];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h Tue Sep 20 16:00:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h Tue Sep 20 23:43:52 2011 +0200
@@ -71,8 +71,6 @@
void *HW_getSDLWindow(void);
void HW_terminate(BOOL andCloseFrontend);
- void HW_suspend(void);
- void HW_resume(void);
void HW_setCursor(int x, int y);
void HW_getCursor(int *x, int *y);
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Sep 20 16:00:20 2011 -0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Tue Sep 20 23:43:52 2011 +0200
@@ -1755,7 +1755,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FPC_COMMON_OPTIONS = "-dIPHONEOS -Cs2000000 -vwi -B -Sgix";
- FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.7.1;
+ FPC_COMPILER_BINARY_DIR = /usr/local/lib/fpc/2.5.1;
FPC_MAIN_FILE = "$(PROJECT_DIR)/../../hedgewars/hwLibrary.pas";
FPC_RTL_UNITS_BASE = /usr/local/lib/fpc;
FPC_SPECIFIC_OPTIONS = "-dDEBUGFILE -O- -g -gl -gw2 -gt -ghttt -Xs-";