code working on ios now hedgeroid
authorkoda
Mon, 26 Sep 2011 01:16:15 +0200
branchhedgeroid
changeset 6027 302408e45052
parent 6025 cac1d5601d7c
child 6029 5073285b6599
code working on ios now
hedgewars/hwLibrary.pas
hedgewars/uAI.pas
hedgewars/uConsole.pas
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/hwLibrary.pas	Mon Sep 26 00:03:14 2011 +0200
+++ b/hedgewars/hwLibrary.pas	Mon Sep 26 01:16:15 2011 +0200
@@ -28,6 +28,7 @@
 uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF};
 exports Game, HW_versionInfo;
 
+{$IFDEF ANDROID}
 function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl;
 begin
     JNI_HW_versionInfoNet := cNetProtoVersion;
@@ -38,8 +39,6 @@
     JNI_HW_versionInfoVersion := env^.NewStringUTF(env, PChar(cVersionString));
 end;
 
-
-{$IFDEF ANDROID}
 exports
     JNI_HW_versionInfoNet name Java_Prefix+'HWversionInfoNetProto', 
     JNI_HW_versionInfoVersion name Java_Prefix+'HWversionInfoVersion', 
--- a/hedgewars/uAI.pas	Mon Sep 26 00:03:14 2011 +0200
+++ b/hedgewars/uAI.pas	Mon Sep 26 01:16:15 2011 +0200
@@ -74,8 +74,7 @@
        with CurrentHedgehog^ do
             a:= CurAmmoType;
        aa:= a;
-SDL_delay(0);
-//       ThreadSwitch();
+       SDL_delay(0);    //ThreadSwitch was only a hint
        
        repeat
         if (CanUseAmmo[a]) and
@@ -320,8 +319,12 @@
 for a:= Low(TAmmoType) to High(TAmmoType) do
     CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(Me^.Hedgehog^, a);
 AddFileLog('Enter Think Thread');
-//BeginThread(@Think, Me, ThinkThread)
+{$IFDEF IPHONEOS}
+//TODO: sdl_thread works on device but crashes in simulator, most likely because of outdated toolchain
+BeginThread(@Think, Me, ThinkThread);
+{$ELSE}
 ThinkThread := SDL_CreateThread(@Think, Me);
+{$ENDIF}
 AddFileLog('Thread started');
 end;
 
--- a/hedgewars/uConsole.pas	Mon Sep 26 00:03:14 2011 +0200
+++ b/hedgewars/uConsole.pas	Mon Sep 26 01:16:15 2011 +0200
@@ -91,6 +91,12 @@
 {$ENDIF}
 end;
 
+function ShortStringAsPChar(s: ShortString) : PChar;
+begin
+    if Length(S) = High(s) then Dec(s[0]);
+    s[Ord(Length(s))+1] := #0;
+    Result := @S[1];
+end;
 
 function GetLastConsoleLine: shortstring;
 var valueStr: shortstring;
@@ -125,12 +131,4 @@
 
 end;
 
-Function ShortStringAsPChar(S: ShortString) : PChar;
-Var NewString : String;
-Begin
-if Length(S) = High(S) then Dec(S[0]);
-s[Ord(Length(s))+1] := #0;
-Result := @S[1];
-End;
-
 end.
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Sep 26 00:03:14 2011 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Sep 26 01:16:15 2011 +0200
@@ -52,6 +52,7 @@
 		61188C0712A6FE960026C5DA /* settingsButton@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FECA1298CE4E00D73365 /* settingsButton@2x.png */; };
 		61188C0812A6FE9A0026C5DA /* title@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 618899811299516000D55FD6 /* title@2x~iphone.png */; };
 		61188C0912A6FE9C0026C5DA /* tw@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6103D385129B348200911D8D /* tw@2x.png */; };
+		611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */ = {isa = PBXBuildFile; fileRef = 611D7A4F142FDCD3006E0798 /* uTouch.pas */; };
 		611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; };
 		611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */; };
 		611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; };
@@ -357,6 +358,7 @@
 		6103D39C129B350700911D8D /* arrowRight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowRight@2x.png"; path = "Resources/Overlay/arrowRight@2x.png"; sourceTree = "<group>"; };
 		6103D39D129B350700911D8D /* arrowUp@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "arrowUp@2x.png"; path = "Resources/Overlay/arrowUp@2x.png"; sourceTree = "<group>"; };
 		6103D39E129B350700911D8D /* cornerButton@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cornerButton@2x.png"; path = "Resources/Overlay/cornerButton@2x.png"; sourceTree = "<group>"; };
+		611D7A4F142FDCD3006E0798 /* uTouch.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uTouch.pas; path = ../../hedgewars/uTouch.pas; sourceTree = SOURCE_ROOT; };
 		611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = "<group>"; };
 		611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = "<group>"; };
 		611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SavedGamesViewController.xib; path = ../Resources/SavedGamesViewController.xib; sourceTree = "<group>"; };
@@ -1103,6 +1105,7 @@
 		9283015C0F10E48900CC5A3C /* Pascal Sources */ = {
 			isa = PBXGroup;
 			children = (
+				611D7A4F142FDCD3006E0798 /* uTouch.pas */,
 				61A976B2136F668500DD9878 /* uCursor.pas */,
 				61E5D68C12AB006F00566F29 /* uLandPainted.pas */,
 				61A4A3A112A5CD56004D81E6 /* uCaptions.pas */,
@@ -1595,6 +1598,7 @@
 				61A976B3136F668500DD9878 /* uCursor.pas in Sources */,
 				6167A6761391514600AA6D07 /* RestoreViewController.m in Sources */,
 				61C28D3F142D380400DA16C2 /* AudioManagerController.m in Sources */,
+				611D7A50142FDCD3006E0798 /* uTouch.pas in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};