screenshot binding for library (on ios it just plays the sound)
authorkoda
Fri, 11 Feb 2011 00:15:11 +0100
changeset 4939 6d512ba87f72
parent 4938 0985edac2ad7
child 4940 e247addb947c
screenshot binding for library (on ios it just plays the sound)
hedgewars/PascalExports.pas
hedgewars/hwengine.pas
project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
project_files/HedgewarsMobile/Classes/PascalImports.h
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/PascalExports.pas	Wed Feb 09 23:26:01 2011 -0500
+++ b/hedgewars/PascalExports.pas	Fri Feb 11 00:15:11 2011 +0100
@@ -164,6 +164,11 @@
     KeyPressChat(13); // enter - removes chat
 end;
 
+procedure HW_screenshot; cdecl; export;
+begin
+    flagMakeCapture:= true;
+end;
+
 procedure HW_pause; cdecl; export;
 begin
     if isPaused = false then
--- a/hedgewars/hwengine.pas	Wed Feb 09 23:26:01 2011 -0500
+++ b/hedgewars/hwengine.pas	Fri Feb 11 00:15:11 2011 +0100
@@ -115,7 +115,7 @@
         s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks);
         WriteLnToConsole('Saving ' + s + '...');
         playSound(sndShutter);
-        MakeScreenshot(s);
+        {$IFNDEF IPHONEOS}MakeScreenshot(s);{$ENDIF}
     end;
 end;
 
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Wed Feb 09 23:26:01 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Fri Feb 11 00:15:11 2011 +0100
@@ -237,7 +237,7 @@
     GLubyte *buffer_flipped = (GLubyte *) malloc(size * sizeof(GLubyte));
 
     glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-
+    HW_screenshot();
     // flip the data as glReadPixels here reads upside down
     for(int y = 0; y <height; y++)
         for(int x = 0; x <width * 4; x++)
--- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Wed Feb 09 23:26:01 2011 -0500
+++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Fri Feb 11 00:15:11 2011 +0100
@@ -63,6 +63,7 @@
     void HW_chat(void);
     void HW_chatEnd(void);
     void HW_tab(void);
+    void HW_screenshot(void);
 
     void HW_pause(void);
     void HW_pauseToggle(void);
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Wed Feb 09 23:26:01 2011 -0500
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Fri Feb 11 00:15:11 2011 +0100
@@ -1576,7 +1576,7 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		1D6058900D05DD3D006BFB54 /* Hedgewars */ = {
+		1D6058900D05DD3D006BFB54 /* Test Lua */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Hedgewars" */;
 			buildPhases = (
@@ -1667,7 +1667,7 @@
 			);
 			projectRoot = "";
 			targets = (
-				1D6058900D05DD3D006BFB54 /* Hedgewars */,
+				1D6058900D05DD3D006BFB54 /* Test Lua */,
 				928301160F10CAFC00CC5A3C /* fpc */,
 				6179928B114AE0C800BA94A9 /* UpdateDataFolder */,
 			);