Tweak Construction Mode, HedgeEditor, Space Invasion and Tumbler to support touch interface
authorWuzzy <Wuzzy2@mail.ru>
Mon, 26 Nov 2018 19:10:08 +0100
changeset 14322 8fc6ac47f00a
parent 14321 79e07510b8e3
child 14323 8d2983ff939b
Tweak Construction Mode, HedgeEditor, Space Invasion and Tumbler to support touch interface
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Mon Nov 26 18:03:39 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Mon Nov 26 19:10:08 2018 +0100
@@ -297,8 +297,14 @@
 function DrawClanPowerTag()
 
 	local zoomL = 1.1
-	local xOffset = 45
-	local yOffset = 70
+	local xOffset, yOffset
+	if INTERFACE == "touch" then
+		xOffset = 126
+		yOffset = ScreenHeight - 32
+	else
+		xOffset = 45
+		yOffset = 70
+	end
 	local tValue = clanPower[GetHogClan(CurrentHedgehog)]
 	local tCol = GetClanColor(GetHogClan(CurrentHedgehog))
 
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Mon Nov 26 18:03:39 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Mon Nov 26 19:10:08 2018 +0100
@@ -2868,7 +2868,12 @@
 -- Display the X and Y coordinates of the cursor while the cursor is active
 function updateCursorCoords()
 	if band(GetState(CurrentHedgehog), gstChooseTarget) ~= 0 and CursorX ~= NO_CURSOR then
-		local x1, y = 12, 24
+		local x1, y
+		if INTERFACE == "touch" then
+			x1, y = 126, 32
+		else
+			x1, y = 12, 24
+		end
 		if tagCursorX then
 			DeleteVisualGear(tagCursorX)
 		end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Mon Nov 26 18:03:39 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Mon Nov 26 19:10:08 2018 +0100
@@ -331,28 +331,49 @@
 function DrawTag(i)
 
 	local zoomL = 1.3
-	local xOffset = 40
-	local yOffset, tValue, tCol
+	local xOffset, yOffset, tValue, tCol
 
 	if i == SI.TAG_TIME then
-		yOffset = 40
+		if INTERFACE == "touch" then
+			xOffset = 60
+			yOffset = ScreenHeight - 35
+		else
+			xOffset = 40
+			yOffset = 40
+		end
 		tCol = SI.colorTimer
 		tValue = SI.TimeLeft
 	elseif i == SI.TAG_BARRELS then
 		zoomL = 1.1
-		yOffset = 70
+		if INTERFACE == "touch" then
+			xOffset = 126
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40
+			yOffset = 70
+		end
 		tCol = SI.colorAmmo
 		tValue = SI.wepAmmo[SI.wepIndex]
 	elseif i == SI.TAG_SHIELD then
 		zoomL = 1.1
-		xOffset = 40 + 35
-		yOffset = 70
+		if INTERFACE == "touch" then
+			xOffset = 126 + 35
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40 + 35
+			yOffset = 70
+		end
 		tCol = SI.colorShield
 		tValue = SI.shieldHealth - 80
 	elseif i == SI.TAG_ROUND_SCORE then
 		zoomL = 1.1
-		xOffset = 40
-		yOffset = 100
+		if INTERFACE == "touch" then
+			xOffset = 126 + 70
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40
+			yOffset = 100
+		end
 		tCol = SI.colorScore
 		tValue = SI.roundScore
 	end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua	Mon Nov 26 18:03:39 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Tumbler.lua	Mon Nov 26 19:10:08 2018 +0100
@@ -281,29 +281,51 @@
 
 function DrawTag(i)
 
-	zoomL = 1.3
+	local zoomL = 1.3
 
-	xOffset = 40
+	local xOffset, yOffset, tValue, tCol
 
 	if i == 0 then
-		yOffset = 40
+		if INTERFACE == "touch" then
+			xOffset = 60
+			yOffset = ScreenHeight - 35
+		else
+			xOffset = 40
+			yOffset = 40
+		end
 		tCol = 0xffee00ff
 		tValue = TimeLeft
 	elseif i == 1 then
 		zoomL = 1.1
-		yOffset = 70
+		if INTERFACE == "touch" then
+			xOffset = 126
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40
+			yOffset = 70
+		end
 		tCol = wepCol[0]
 		tValue = wepAmmo[0]
 	elseif i == 2 then
 		zoomL = 1.1
-		xOffset = 40 + 35
-		yOffset = 70
+		if INTERFACE == "touch" then
+			xOffset = 126 + 35
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40 + 35
+			yOffset = 70
+		end
 		tCol = wepCol[1]
 		tValue = wepAmmo[1]
 	elseif i == 3 then
 		zoomL = 1.1
-		xOffset = 40 + 70
-		yOffset = 70
+		if INTERFACE == "touch" then
+			xOffset = 126 + 70
+			yOffset = ScreenHeight - 37
+		else
+			xOffset = 40 + 70
+			yOffset = 70
+		end
 		tCol = wepCol[2]
 		tValue = wepAmmo[2]
 	end