added hide/show animation for the aiming keys (should animateWidget() be moved to another unit?)
authorXeli
Thu, 16 Feb 2012 17:48:03 +0100
changeset 6691 79c96abd06d6
parent 6690 46b3f4776538
child 6692 029c27660dd2
added hide/show animation for the aiming keys (should animateWidget() be moved to another unit?)
hedgewars/uTeams.pas
hedgewars/uWorld.pas
--- a/hedgewars/uTeams.pas	Thu Feb 16 20:32:47 2012 +0400
+++ b/hedgewars/uTeams.pas	Thu Feb 16 17:48:03 2012 +0100
@@ -20,7 +20,7 @@
 
 unit uTeams;
 interface
-uses uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uTypes;
+uses uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit, uSound, uTypes, uWorld;
 
 procedure initModule;
 procedure freeModule;
@@ -183,7 +183,24 @@
 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
 
 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
-
+{$IFDEF USE_TOUCH_INTERFACE}
+if (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
+    begin
+    if not(arrowUp.show) then
+        begin
+        animateWidget(@arrowUp, true, true);
+        animateWidget(@arrowDown, true, true);
+        animateWidget(@arrowRight, false, true);
+        end;
+    end
+else
+    if arrowUp.show then
+        begin
+        animateWidget(@arrowUp, true, false);
+        animateWidget(@arrowDown, true, false);
+        animateWidget(@arrowRight, false, true);
+        end;
+{$ENDIF}
 AmmoMenuInvalidated:= true;
 end;
 
--- a/hedgewars/uWorld.pas	Thu Feb 16 20:32:47 2012 +0400
+++ b/hedgewars/uWorld.pas	Thu Feb 16 17:48:03 2012 +0100
@@ -618,6 +618,24 @@
                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
                 bSelected:= false;
                 FreeWeaponTooltip;
+{$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
+                if (Ammo^[Slot, Pos].Propz and ammoprop_NoCrosshair) = 0 then
+                    begin
+                    if not(arrowUp.show) then
+                        begin
+                        animateWidget(@arrowUp, true, true);
+                        animateWidget(@arrowDown, true, true);
+                        animateWidget(@arrowRight, false, true);
+                        end;
+                    end
+                else
+                    if arrowUp.show then
+                        begin
+                        animateWidget(@arrowUp, true, false);
+                        animateWidget(@arrowDown, true, false);
+                        animateWidget(@arrowRight, false, true);
+                        end;
+{$ENDIF}
 
                 exit
                 end;