hedgewars/uWorld.pas
changeset 14562 42f7ce0f5bc6
parent 14559 1dab5d92aca7
child 14563 e68b91abbcf5
equal deleted inserted replaced
14561:ed90b5e2545b 14562:42f7ce0f5bc6
    40 procedure SetUtilityWidgetState(ammoType: TAmmoType);
    40 procedure SetUtilityWidgetState(ammoType: TAmmoType);
    41 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
    41 procedure animateWidget(widget: POnScreenWidget; fade, showWidget: boolean);
    42 procedure MoveCamera;
    42 procedure MoveCamera;
    43 procedure onFocusStateChanged;
    43 procedure onFocusStateChanged;
    44 procedure updateCursorVisibility;
    44 procedure updateCursorVisibility;
       
    45 procedure updateTouchWidgets(ammoType: TAmmoType);
    45 
    46 
    46 implementation
    47 implementation
    47 uses
    48 uses
    48     uStore
    49     uStore
    49     , uMisc
    50     , uMisc
   779                 begin
   780                 begin
   780                 bShowAmmoMenu:= false;
   781                 bShowAmmoMenu:= false;
   781                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
   782                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
   782                 bSelected:= false;
   783                 bSelected:= false;
   783                 FreeAndNilTexture(WeaponTooltipTex);
   784                 FreeAndNilTexture(WeaponTooltipTex);
   784 {$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
   785                 updateTouchWidgets(Ammo^[Slot, Pos].AmmoType);
   785                 if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then
       
   786                     begin
       
   787                     if (not arrowUp.show) then
       
   788                         begin
       
   789                         animateWidget(@arrowUp, true, true);
       
   790                         animateWidget(@arrowDown, true, true);
       
   791                         end;
       
   792                     end
       
   793                 else
       
   794                     if arrowUp.show then
       
   795                         begin
       
   796                         animateWidget(@arrowUp, true, false);
       
   797                         animateWidget(@arrowDown, true, false);
       
   798                         end;
       
   799                 SetUtilityWidgetState(Ammo^[Slot, Pos].AmmoType);
       
   800 {$ENDIF}
       
   801                 exit
   786                 exit
   802                 end;
   787                 end;
   803             end
   788             end
   804         end
   789         end
   805     else
   790     else
  2127         SDL_ShowCursor(1)
  2112         SDL_ShowCursor(1)
  2128     else
  2113     else
  2129         SDL_ShowCursor(ord(GameState = gsConfirm))
  2114         SDL_ShowCursor(ord(GameState = gsConfirm))
  2130 end;
  2115 end;
  2131 
  2116 
       
  2117 procedure updateTouchWidgets(ammoType: TAmmoType);
       
  2118 begin
       
  2119 {$IFDEF USE_TOUCH_INTERFACE}
       
  2120 //show the aiming buttons + animation
       
  2121 if (Ammoz[ammoType].Ammo.Propz and ammoprop_NeedUpDown) <> 0 then
       
  2122     begin
       
  2123     if (not arrowUp.show) then
       
  2124         begin
       
  2125         animateWidget(@arrowUp, true, true);
       
  2126         animateWidget(@arrowDown, true, true);
       
  2127         end;
       
  2128     end
       
  2129 else
       
  2130     if arrowUp.show then
       
  2131         begin
       
  2132         animateWidget(@arrowUp, true, false);
       
  2133         animateWidget(@arrowDown, true, false);
       
  2134         end;
       
  2135 SetUtilityWidgetState(ammoType);
       
  2136 {$ELSE}
       
  2137 ammoType:= ammoType; // avoid hint
       
  2138 {$ENDIF}
       
  2139 end;
       
  2140 
  2132 procedure SetUtilityWidgetState(ammoType: TAmmoType);
  2141 procedure SetUtilityWidgetState(ammoType: TAmmoType);
  2133 begin
  2142 begin
  2134 {$IFDEF USE_TOUCH_INTERFACE}
  2143 {$IFDEF USE_TOUCH_INTERFACE}
  2135 if(ammoType = amNothing)then
  2144 if(ammoType = amNothing)then
  2136     ammoType:= CurrentHedgehog^.CurAmmoType;
  2145     ammoType:= CurrentHedgehog^.CurAmmoType;