# HG changeset patch # User Xeli # Date 1327612792 -3600 # Node ID 5965e2927b3d279ca14fd2be0a5c99a28f78e002 # Parent 5810e42d8375867a675d929e14bcba155c3e5e08 fixed the ammo menu on android, on tablets all weapons are 'choosable' and on phones I've moved the ammomenu up a bit diff -r 5810e42d8375 -r 5965e2927b3d hedgewars/uMobile.pas --- a/hedgewars/uMobile.pas Thu Jan 26 16:04:08 2012 +0400 +++ b/hedgewars/uMobile.pas Thu Jan 26 22:19:52 2012 +0100 @@ -41,7 +41,7 @@ procedure SaveLoadingEnded; inline; implementation -uses uVariables; +uses uVariables, uConsole; // this function is just to determine whether we are running on a limited screen device function isPhone: Boolean; inline; @@ -49,7 +49,16 @@ {$IFDEF IPHONEOS} exit(isApplePhone()); {$ENDIF} +{$IFDEF ANDROID} + //nasty nasty hack. TODO: implement callback to java to have a unified way of determining if it is a tablet + if (cScreenWidth < 1000) and (cScreenHeight < 500) then + begin + exit(true); + end + else exit(false); +{$ELSE} exit(false); +{$ENDIF} end; // this function should make the device vibrate in some way diff -r 5810e42d8375 -r 5965e2927b3d hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Jan 26 16:04:08 2012 +0400 +++ b/hedgewars/uWorld.pas Thu Jan 26 22:19:52 2012 +0100 @@ -192,7 +192,7 @@ WorldDx:= - (LAND_WIDTH div 2) + cScreenWidth div 2; WorldDy:= - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); AMSlotSize:= 33; -{$IFDEF IPHONEOS} +{$IFDEF MOBILE} if isPhone() then begin AMxOffset:= -30 + cScreenHeight div 2; @@ -289,7 +289,7 @@ SlotsNum:= 0; x:= (cScreenWidth shr 1) - AMWidth + AMxShift; -{$IFDEF IPHONEOS} +{$IFDEF MOBILE} Slot:= cMaxSlotIndex; x:= x - cOffsetY; y:= AMyOffset; @@ -418,7 +418,7 @@ RenderWeaponTooltip(amSel) end; -{$IFDEF IPHONEOS} +{$IFDEF MOBILE} DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); if Ammo^[Slot, Pos].Count < AMMO_INFINITE then DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + 163, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); @@ -442,8 +442,12 @@ FreeWeaponTooltip; if (WeaponTooltipTex <> nil) and (AMxShift = 0) then -{$IFDEF IPHONEOS} +{$IFDEF MOBILE} + {$IFDEF ANDROID} + ShowWeaponTooltip((AMxOffset - (cScreenHeight div 2)) - WeaponTooltipTex^.w, (AMyOffset + ((SlotsNum * AmSlotSize)div 2)) - (WeaponTooltipTex^.h div 2)); + {$ELSE} ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, 100); + {$ENDIF} {$ELSE} ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); {$ENDIF} @@ -983,6 +987,7 @@ // Draw buttons Related to the Touch interface DrawTexture(Round(-cScreenWidth*0.5 + cScreenHeight*0.02),Round((cScreenHeight*0.98)-(spritesData[sprFireButton].Height*0.4) ),spritesData[sprFireButton].Texture, 0.4); {$ENDIF} + // Teams Healths if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays begin