moved the firebutton, added the AMWidget button and removed the forwardjump widget(it's longpress on backjump now)
authorXeli
Sat, 18 Feb 2012 16:56:04 +0100
changeset 6714 f2f93017132c
parent 6712 c582869fbe7f
child 6715 54faf3034720
moved the firebutton, added the AMWidget button and removed the forwardjump widget(it's longpress on backjump now)
hedgewars/uTouch.pas
hedgewars/uTypes.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/uTouch.pas	Sat Feb 18 15:24:20 2012 +0100
+++ b/hedgewars/uTouch.pas	Sat Feb 18 16:56:04 2012 +0100
@@ -141,7 +141,7 @@
      finger^.pressedWidget:= @pauseButton;
      exit;
      end;
-
+     
 dec(buttonsDown);//no buttonsDown, undo the inc() above
 if buttonsDown = 0 then
     begin
@@ -254,7 +254,7 @@
 
 procedure onTouchLongClick(finger: TTouch_Data);
 begin
-if isOnRect(backjump.active, finger) then
+if isOnRect(jumpWidget.active, finger) then
     begin
     ParseCommand('ljump', (CurrentTeam <> nil) and not(CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel=0));
     if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
@@ -290,13 +290,13 @@
     end;
 
 
-if isOnCurrentHog(finger) then
+if isOnCurrentHog(finger) or isOnRect(AMWidget.active, finger) then
     begin
     bShowAmmoMenu := true;
     exit;
     end;
 
-if isOnRect(backjump.active, finger) then
+if isOnRect(jumpWidget.active, finger) then
     begin
     ParseCommand('hjump', (CurrentTeam <> nil) and not(CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel=0));
     if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
--- a/hedgewars/uTypes.pas	Sat Feb 18 15:24:20 2012 +0100
+++ b/hedgewars/uTypes.pas	Sat Feb 18 16:56:04 2012 +0100
@@ -59,7 +59,7 @@
             sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR,
 {$IFDEF USE_TOUCH_INTERFACE}
             sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight,
-            sprBackjump, sprForwardjump, sprPauseButton,
+            sprJumpWidget, sprAMWidget, sprPauseButton,
 {$ENDIF}
             sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun,
             sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
--- a/hedgewars/uVariables.pas	Sat Feb 18 15:24:20 2012 +0100
+++ b/hedgewars/uVariables.pas	Sat Feb 18 16:56:04 2012 +0100
@@ -198,9 +198,9 @@
 {$IFDEF USE_TOUCH_INTERFACE}
     buttonScale: GLFloat;
 
-    arrowUp, arrowDown, arrowLeft, arrowRight: TOnScreenWidget;
-    firebutton, backjump, forwardjump: TOnScreenWidget;
-	pauseButton: TOnScreenWidget;
+    arrowUp, arrowDown, arrowLeft, arrowRight : TOnScreenWidget;
+    firebutton, jumpWidget, AMWidget          : TOnScreenWidget;
+    pauseButton                               : TOnScreenWidget;
 {$ENDIF}
 const
     cHHFileName = 'Hedgehog';
@@ -395,10 +395,10 @@
             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowLeft
             (FileName: 'arrowRight'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
             Width: 100; Height: 100; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprArrowRight
+            (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), // sprAMWidget
             (FileName: 'backjump'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
-            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
+            Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true), // sprJumpWidget
             (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}
--- a/hedgewars/uWorld.pas	Sat Feb 18 15:24:20 2012 +0100
+++ b/hedgewars/uWorld.pas	Sat Feb 18 16:56:04 2012 +0100
@@ -213,24 +213,25 @@
 //positioning of the buttons
 buttonScale:= 1.5/cDefaultZoomLevel;
 
-with firebutton do
+
+with JumpWidget do
     begin
     show:= true;
-    sprite:= sprFireButton;
+    sprite:= sprJumpWidget;
     frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
-    frame.x:= (cScreenWidth shr 1) - frame.w;
-    frame.y:= cScreenHeight - frame.h;
+    frame.x:= (cScreenWidth shr 1) - Round(frame.w * 1.2);
+    frame.y:= cScreenHeight - frame.h * 2;
     active.x:= frame.x;
     active.y:= frame.y;
     active.w:= frame.w;
     active.h:= frame.h;
     end;
 
-with backjump do
+with AMWidget do
     begin
     show:= true;
-    sprite:= sprbackjump;
+    sprite:= sprAMWidget;
     frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
@@ -241,20 +242,6 @@
     active.h:= frame.h;
     end;
 
-with forwardjump do
-    begin
-    show:= true;
-    sprite:= sprforwardjump;
-    frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
-    frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
-    frame.x:= (cScreenWidth shr 1) - Round(frame.w * 1.2);
-    frame.y:= cScreenHeight - frame.h * 2;
-    active.x:= frame.x;
-    active.y:= frame.y;
-    active.w:= frame.w;
-    active.h:= frame.h;
-    end;
-
 with arrowLeft do
     begin
     show:= true;
@@ -283,6 +270,20 @@
     active.h:= frame.h;
     end;
 
+with firebutton do
+    begin
+    show:= true;
+    sprite:= sprFireButton;
+    frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
+    frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
+    frame.x:= arrowRight.frame.x + arrowRight.frame.w;
+    frame.y:= arrowRight.frame.y + (arrowRight.frame.w shr 1) - (frame.w shr 1);
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
+    end;
+
 with arrowUp do
     begin
     show:= false;
@@ -290,7 +291,7 @@
     frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
-    frame.y:= backjump.frame.y - Round(frame.h * 2.25);
+    frame.y:= jumpWidget.frame.y - Round(frame.h * 2.25);
     active.x:= frame.x;
     active.y:= frame.y;
     active.w:= frame.w;
@@ -311,7 +312,7 @@
     frame.w:= Round(spritesData[sprite].Texture^.w * buttonScale);
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
-    frame.y:= backjump.frame.y - Round(frame.h * 2.25);
+    frame.y:= jumpWidget.frame.y - Round(frame.h * 2.25);
     active.x:= frame.x;
     active.y:= frame.y;
     active.w:= frame.w;
@@ -1212,8 +1213,8 @@
 DrawScreenWidget(@arrowDown);
 
 DrawScreenWidget(@fireButton);
-DrawScreenWidget(@backjump);
-DrawScreenWidget(@forwardjump);
+DrawScreenWidget(@jumpWidget);
+DrawScreenWidget(@AMWidget);
 DrawScreenWidget(@pauseButton);
 {$ENDIF}