moved other widgets under the USE_TOUCH_INTERFACE, added pause button (at least, graphically...)
authorkoda
Wed, 15 Feb 2012 18:22:39 +0100
changeset 6685 ef706fccfb0a
parent 6684 112a0eb8782b
child 6686 bdb7c67eba06
moved other widgets under the USE_TOUCH_INTERFACE, added pause button (at least, graphically...)
hedgewars/uCaptions.pas
hedgewars/uTouch.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/uCaptions.pas	Wed Feb 15 18:03:51 2012 +0100
+++ b/hedgewars/uCaptions.pas	Wed Feb 15 18:22:39 2012 +0100
@@ -80,7 +80,7 @@
     grp: TCapGroup;
     offset: LongInt;
 begin
-{$IFDEF MOBILE}
+{$IFDEF USE_TOUCH_INTERFACE}
     offset:= 48;
 {$ELSE}
     offset:= 8;
--- a/hedgewars/uTouch.pas	Wed Feb 15 18:03:51 2012 +0100
+++ b/hedgewars/uTouch.pas	Wed Feb 15 18:22:39 2012 +0100
@@ -153,6 +153,11 @@
                 backspaceKey:= true;
                 exit;
             end;
+            if isOnRect(pauseButton, finger^) then
+            begin
+                isPaused:= not isPaused;
+                exit;
+            end;
             moveCursor:= not bShowAmmoMenu;
         end;
         2:
--- a/hedgewars/uTypes.pas	Wed Feb 15 18:03:51 2012 +0100
+++ b/hedgewars/uTypes.pas	Wed Feb 15 18:22:39 2012 +0100
@@ -53,13 +53,13 @@
             sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower,
             sprClusterBomb, sprClusterParticle, sprFlame,
             sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR,
-//    sprAMBorderHorizontal, sprAMBorderVertical, 
             sprAMSlot, sprAMAmmos, sprAMAmmosBW, sprAMSlotKeys, sprAMCorners,
             sprFinger, sprAirBomb, sprAirplane, sprAmAirplane, sprAmGirder,
             sprHHTelepMask, sprSwitch, sprParachute, sprTarget, sprRopeNode,
             sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR,
 {$IFDEF USE_TOUCH_INTERFACE}
-            sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight, sprBackjump, sprForwardjump,
+            sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight,
+            sprBackjump, sprForwardjump, sprPauseButton,
 {$ENDIF}
             sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun,
             sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
@@ -424,10 +424,10 @@
     TDirtyTag = packed array of array of byte;
 
 	TOnScreenWidget = record
-		x, y: LongInt;			 	// graphical coordinates
-		hOffset, width: LongInt;	// horizontal active region
-		vOffset, height: LongInt;	// vertical active region
-		end;
+        x, y: LongInt;			 	// graphical coordinates
+        hOffset, width: LongInt;	// horizontal active region
+        vOffset, height: LongInt;	// vertical active region
+        end;
 
 implementation
 
--- a/hedgewars/uVariables.pas	Wed Feb 15 18:03:51 2012 +0100
+++ b/hedgewars/uVariables.pas	Wed Feb 15 18:22:39 2012 +0100
@@ -198,8 +198,9 @@
 {$IFDEF USE_TOUCH_INTERFACE}
     buttonScale: GLFloat;
 
-    arrowUp, arrowDown, arrowLeft, arrowRight: TOnScreenWidget; 
-    firebutton, backjump, forwardjump: TOnScreenWidget; 
+    arrowUp, arrowDown, arrowLeft, arrowRight: TOnScreenWidget;
+    firebutton, backjump, forwardjump: TOnScreenWidget;
+	pauseButton: TOnScreenWidget;
 {$ENDIF}
 const
     cHHFileName = 'Hedgehog';
@@ -343,12 +344,6 @@
             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
             (FileName:       'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
             Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
-(*
-            (FileName:  'BorderHorizontal'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 32; Height:  2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderHorizontal
-            (FileName:  'BorderVertical'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 2; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderVertical
-*)
             (FileName:   'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
             Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot
             (FileName:      'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
@@ -404,6 +399,8 @@
             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprBackjump
             (FileName: 'forwardjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
             Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprForwardJump
+            (FileName: 'pause'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
+            Width: 120; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprPauseButton
 {$ENDIF}
             (FileName:      'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil;
             Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake
--- a/hedgewars/uWorld.pas	Wed Feb 15 18:03:51 2012 +0100
+++ b/hedgewars/uWorld.pas	Wed Feb 15 18:22:39 2012 +0100
@@ -261,6 +261,14 @@
 arrowDown.height:= Round(spritesData[sprArrowDown].Texture^.h * buttonScale);
 arrowDown.hOffset:= 0;
 arrowDown.vOffset:= 0;
+
+pauseButton.x:= cScreenWidth div 2 - Round(spritesData[sprPauseButton].Texture^.w * buttonscale);
+pauseButton.y:= 0; //-Round(spritesData[sprPauseButton].Texture^.h * buttonscale);
+pauseButton.width:= Round(spritesData[sprPauseButton].Texture^.w * buttonScale);;
+pauseButton.height:= Round(spritesData[sprPauseButton].Texture^.h * buttonScale);;
+pauseButton.hOffset:= 0;
+pauseButton.vOffset:= 0;
+
 {$ENDIF}
 end;
 
@@ -1077,7 +1085,7 @@
 SetScale(cDefaultZoomLevel);
 
 // Turn time
-{$IFDEF MOBILE}
+{$IFDEF USE_TOUCH_INTERFACE}
 offsetX:= cScreenHeight - 13;
 {$ELSE}
 offsetX:= 48;
@@ -1119,6 +1127,7 @@
 DrawTexture(fireButton.x, firebutton.y, spritesData[sprFireButton].Texture, buttonScale);
 DrawTexture(backjump.x, backjump.y, spritesData[sprBackjump].Texture, buttonScale);
 DrawTexture(forwardjump.x, forwardjump.y, spritesData[sprForwardjump].Texture, buttonScale);
+DrawTexture(pauseButton.x, pauseButton.y, spritesData[sprPauseButton].Texture, buttonScale);
 {$ENDIF}
 
 // Teams Healths
@@ -1207,7 +1216,7 @@
     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
 
 // Wind bar
-{$IFDEF MOBILE}
+{$IFDEF USE_TOUCH_INTERFACE}
     offsetX:= cScreenHeight - 13;
     offsetY:= (cScreenWidth shr 1) + 74;
 {$ELSE}
@@ -1264,8 +1273,8 @@
     end;
 
 // fps
-{$IFDEF MOBILE}
-offsetX:= 8;
+{$IFDEF USE_TOUCH_INTERFACE}
+offsetX:= pauseButton.y + pauseButton.height + 12;
 {$ELSE}
 offsetX:= 10;
 {$ENDIF}