added a visual fire button, isOnFireButton check needs to be fixed though it only works on 800x480 screens
--- a/hedgewars/uTouch.pas Sat Aug 20 13:07:33 2011 +0200
+++ b/hedgewars/uTouch.pas Sat Aug 20 13:53:45 2011 +0200
@@ -102,7 +102,7 @@
ParseCommand('+attack', true);
exit;
end;
- if finger.x < leftButtonBoundary then
+ if (finger.x < leftButtonBoundary) and (finger.y < 390) then
begin
ParseCommand('+left', true);
walkingLeft := true;
@@ -375,7 +375,10 @@
function isOnFireButton(finger: Touch_Finger): boolean;
begin
- isOnFireButton:= (finger.x < 150) and (finger.y > 390);
+ printFinger(finger);
+ WriteToConsole(Format('%d %d ',[round((-cScreenWidth+20)/0.8), round((cScreenHeight+55)/0.8)]));
+ WriteToConsole(Format('%d, %d',[cScreenWidth, cScreenHeight]));
+ isOnFireButton:= (finger.x < 205) and (finger.y > 420);
end;
function isOnCrosshair(finger: Touch_Finger): boolean;
--- a/hedgewars/uTypes.pas Sat Aug 20 13:07:33 2011 +0200
+++ b/hedgewars/uTypes.pas Sat Aug 20 13:53:45 2011 +0200
@@ -44,7 +44,7 @@
// Different files are stored in different folders, this enumeration is used to tell which folder to use
TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
- ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath);
+ ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath, ptButtons);
// Available sprites for displaying stuff
TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
@@ -82,7 +82,7 @@
sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
- sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet
+ sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprFireButton
);
// Gears that interact with other Gears and/or Land
--- a/hedgewars/uVariables.pas Sat Aug 20 13:07:33 2011 +0200
+++ b/hedgewars/uVariables.pas Sat Aug 20 13:53:45 2011 +0200
@@ -206,7 +206,8 @@
'Graphics/Hats', // ptHats
'Graphics/Flags', // ptFlags
'Missions/Maps', // ptMissionMaps
- 'Graphics/SuddenDeath' // ptSuddenDeath
+ 'Graphics/SuddenDeath', // ptSuddenDeath
+ 'Graphics/Buttons' // ptButton
);
cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
@@ -601,7 +602,9 @@
(FileName: 'SDSplash'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
Width: 80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSDSplash
(FileName: 'SDDroplet'; Path: ptCurrTheme; AltPath: ptSuddenDeath; Texture: nil; Surface: nil;
- Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true)// sprSDDroplet
+ Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSDDroplet
+ (FileName: 'firebutton'; Path: ptButtons; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 450; Height: 150; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true) // sprFireButton
);
--- a/hedgewars/uWorld.pas Sat Aug 20 13:07:33 2011 +0200
+++ b/hedgewars/uWorld.pas Sat Aug 20 13:53:45 2011 +0200
@@ -908,6 +908,11 @@
// Captions
DrawCaptions;
+// Draw buttons
+SetScale(0.8);
+DrawSprite(sprFireButton, round((-cScreenWidth+20)/0.8),round((cScreenHeight+55)/0.8),0);
+SetScale(cDefaultZoomLevel);
+
// Teams Healths
if TeamsCount * 20 > cScreenHeight div 7 then // take up less screen on small displays
begin