update position of on screen buttons on resize
authorkoda
Mon, 13 Feb 2012 08:18:59 +0100
changeset 6682 bf3cf6e60673
parent 6681 f46b1a1de2ce
child 6683 75a1d84ac606
update position of on screen buttons on resize
hedgewars/hwengine.pas
hedgewars/uWorld.pas
--- a/hedgewars/hwengine.pas	Sun Feb 12 15:11:47 2012 -0500
+++ b/hedgewars/hwengine.pas	Mon Feb 13 08:18:59 2012 +0100
@@ -268,6 +268,7 @@
             WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight));
             ScriptOnScreenResize();
             InitCameraBorders();
+            InitTouchInterface();
             end;
 
         if isTerminated = false then
--- a/hedgewars/uWorld.pas	Sun Feb 12 15:11:47 2012 -0500
+++ b/hedgewars/uWorld.pas	Mon Feb 13 08:18:59 2012 +0100
@@ -35,6 +35,7 @@
 procedure HideMission;
 procedure ShakeCamera(amount: LongInt);
 procedure InitCameraBorders;
+procedure InitTouchInterface;
 procedure MoveCamera;
 procedure onFocusStateChanged;
 
@@ -197,6 +198,16 @@
 SkyOffset:= 0;
 HorizontOffset:= 0;
 
+InitTouchInterface();
+end;
+
+procedure InitCameraBorders;
+begin
+cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5);
+end;
+
+procedure InitTouchInterface;
+begin
 {$IFDEF USE_TOUCH_INTERFACE}
 //positioning of the buttons
 buttonScale:= 1.5/cDefaultZoomLevel;
@@ -234,16 +245,9 @@
 arrowDownY:= -Round(spritesData[sprArrowDown].Texture^.h*buttonscale) + cScreenHeight;
 arrowDownW:= Round(spritesData[sprArrowDown].Texture^.w * buttonScale);
 arrowDownH:= Round(spritesData[sprArrowDown].Texture^.h * buttonScale);
-
-
 {$ENDIF}
 end;
 
-procedure InitCameraBorders;
-begin
-cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5);
-end;
-
 // for uStore texture resetting
 procedure ResetWorldTex;
 begin