shifted placement of resource and trading GUI elements

This commit is contained in:
devZoGok
2024-05-18 15:06:49 +03:00
parent 2dcc1973ae
commit a6c3e3df1c
4 changed files with 36 additions and 37 deletions
+12 -11
View File
@@ -1,7 +1,8 @@
res = graphics.resolution
Size = {x = 70, y = 70}
sz = 210
s = 90
s = 40
resTextScale = {x = .5, y = .5}
resIconBasePath = 'Icons/Resources/'
pointerTex = 'pointer.jpg'
attackTex = 'attack.jpg'
@@ -12,8 +13,8 @@ gui = {
guiType = GuiType.TEXT,
name = 'refineds',
text = '',
pos = {x = 100, y = 100, z = 0},
scale = {x = 1, y = 1},
pos = {x = s, y = s, z = 0},
scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
@@ -23,19 +24,19 @@ gui = {
guiType = GuiType.TEXT,
name = 'wealth',
text = '',
pos = {x = 100, y = 200, z = 0},
scale = {x = 1, y = 1},
pos = {x = 200 + s, y = s, z = 0},
scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
color = {x = 1, y = 0, z = 1, w = 1}
color = {x = 1, y = 1, z = 1, w = 1}
},
{
guiType = GuiType.TEXT,
name = 'research',
text = '',
pos = {x = 100, y = 300, z = 0},
scale = {x = 1, y = 1},
pos = {x = 400 + s, y = s, z = 0},
scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
@@ -49,13 +50,13 @@ gui = {
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = 100, z = 0},
pos = {x = 200, y = 0, z = 0},
size = {x = s, y = s},
imagePath = resIconBasePath .. 'wealth.jpg',
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = 200, z = 0},
pos = {x = 400, y = 0, z = 0},
size = {x = s, y = s},
imagePath = resIconBasePath .. 'research.jpg',
},
@@ -64,7 +65,7 @@ gui = {
name = 'depth',
text = '',
pos = {x = 0, y = 400, z = 0},
scale = {x = 1, y = 1},
scale = {x = 0, y = 1},
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
+8 -6
View File
@@ -1,15 +1,17 @@
res = graphics.resolution
Pos = {x = 10, y = 10, z = .1}
Size = {x = res.x * .8, y = res.y * .8 + 40}
HubSize = {x = res.x * .5, y = res.y * .8}
HubPos = {x = .5 * (res.x - HubSize.x), y = 10, z = .1}
HubMargin = {top = 10, left = 10, right = 10, bottom = 10}
buttonSize = {x = 100, y = 20}
textboxSize = {x = 200, y = 25}
margin = {top = 10, left = 10, right = 10, bottom = 10}
gui = {
{
guiType = GuiType.GUI_RECTANGLE,
pos = Pos,
size = Size,
pos = HubPos,
size = HubSize,
color = {x = 0, y = 0, z = 0, w = .6}
},
{
@@ -17,7 +19,7 @@ gui = {
buttonType = ButtonType.ACTIVE_GAME_STATE,
name = 'Back',
guiScreen = 'activeGameState.lua',
pos = {x = Pos.x + Size.x - buttonSize.x - margin.right, y = Pos.y + Size.y - buttonSize.y - margin.bottom, z = .11},
pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .11},
size = buttonSize,
trigger = 10
},
+4 -6
View File
@@ -1,11 +1,9 @@
res = graphics.resolution
Pos = {x = 10, y = 10}
Size = {x = res.x * .8, y = res.y * .8}
buttonSize = {x = 100, y = 20}
textboxSize = {x = 200, y = 25}
margin = {top = 10, left = 10, right = 10, bottom = 10}
height = Pos.y + margin.top + lineId * 30
height = HubPos.y + HubMargin.top + lineId * 30
warIcon = 'Icons/PlayerStates/war.png'
allianceIcon = 'Icons/PlayerStates/alliance.png'
@@ -14,7 +12,7 @@ gui = {
guiType = GuiType.TEXT,
name = 'playerName',
text = '',
pos = {x = Pos.x + margin.left, y = height, z = .11},
pos = {x = HubPos.x + HubMargin.left, y = height + 10, z = .11},
scale = {x = .2, y = .2},
font = 'batang.ttf',
fontFirstChar = 0,
@@ -42,7 +40,7 @@ gui = {
buttonType = ButtonType.TRADING_SCREEN,
name = 'Trade',
guiScreen = 'tradingScreen.lua',
pos = {x = Pos.x + Size.x - buttonSize.x - margin.right, y = height, z = .11},
pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = height, z = .11},
size = buttonSize,
trigger = 10
}
+12 -14
View File
@@ -1,9 +1,7 @@
res = graphics.resolution
Pos = {x = 10, y = 10}
Size = {x = res.x * .8, y = res.y * .8}
margin = {top = 100, left = 100, right = 100, bottom = 100}
HubMargin.top = 100
resTrayPos = {x = Pos.x + margin.left, y = Pos.y + margin.top}
resTrayPos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubMargin.top}
iconSize = {x = 25, y = 25}
textboxSize = {x = 200, y = 25}
@@ -13,10 +11,10 @@ ResourceTrayGuiId = {ICON = 0, TEXTBOX = 1, INCREMENT = 2, DECREMENT = 3}
IconPath = {WEALTH = 'Icons/Resources/wealth.jpg', RESEARCH = 'Icons/Resources/research.jpg', REFINEDS = 'Icons/Resources/refineds.jpg', TIME = 'Icons/Resources/time.jpg'}
function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
height = margin.top + lineId * iconSize.y
height = HubMargin.top + lineId * iconSize.y
if guiId == ResourceTrayGuiId.ICON then
guiElPos = {x = Pos.x + (cpuPlayer and margin.left or Size.x -(margin.right + 3 * iconSize.x + textboxSize.x)), y = height, z = .2}
guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left or HubSize.x -(HubMargin.right + 3 * iconSize.x + textboxSize.x)), y = height, z = .2}
return {
guiType = GuiType.GUI_RECTANGLE,
@@ -25,7 +23,7 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
imagePath = imgPath
}
elseif guiId == ResourceTrayGuiId.TEXTBOX then
guiElPos = {x = Pos.x + (cpuPlayer and margin.left + iconSize.x or Size.x -(margin.right + 2 * iconSize.x + textboxSize.x)), y = height, z = .2}
guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + iconSize.x or HubSize.x -(HubMargin.right + 2 * iconSize.x + textboxSize.x)), y = height, z = .2}
return {
pos = guiElPos,
@@ -33,7 +31,7 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
guiType = GuiType.TEXTBOX,
}
elseif guiId == ResourceTrayGuiId.INCREMENT then
guiElPos = {x = Pos.x + (cpuPlayer and margin.left + iconSize.x + textboxSize.x or Size.x -(margin.right + 2 * iconSize.x)), y = height, z = .2}
guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + iconSize.x + textboxSize.x or HubSize.x -(HubMargin.right + 2 * iconSize.x)), y = height, z = .2}
return {
guiType = GuiType.BUTTON,
@@ -45,7 +43,7 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
trigger = 10
}
elseif guiId == ResourceTrayGuiId.DECREMENT then
guiElPos = {x = Pos.x + (cpuPlayer and margin.left + 2 * iconSize.x + textboxSize.x or Size.x -(margin.right + iconSize.x)), y = height, z = .2}
guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + 2 * iconSize.x + textboxSize.x or HubSize.x -(HubMargin.right + iconSize.x)), y = height, z = .2}
return {
guiType = GuiType.BUTTON,
@@ -64,7 +62,7 @@ gui = {
guiType = GuiType.TEXT,
name = 'P0',
text = 'P0',
pos = {x = Pos.x + margin.left, y = Pos.y + margin.top - 20, z = .2},
pos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubMargin.top - 20, z = .2},
scale = {x = .5, y = .5},
font = 'batang.ttf',
fontFirstChar = 0,
@@ -75,7 +73,7 @@ gui = {
guiType = GuiType.TEXT,
name = 'You',
text = 'You',
pos = {x = Pos.x + Size.x -(margin.right + textboxSize.x + iconSize.x + 50), y = Pos.y + margin.top - 20, z = .2},
pos = {x = HubPos.x + HubSize.x -(HubMargin.right + textboxSize.x + iconSize.x + 50), y = HubPos.y + HubMargin.top - 20, z = .2},
scale = {x = .5, y = .5},
font = 'batang.ttf',
fontFirstChar = 0,
@@ -121,7 +119,7 @@ gui = {
buttonType = ButtonType.PLAYER_TRADE,
name = 'Back',
guiScreen = 'tradingHub.lua',
pos = {x = Pos.x + Size.x - 2 * buttonSize.x - margin.right, y = Pos.y + Size.y - buttonSize.y - margin.bottom, z = .2},
pos = {x = HubPos.x + HubSize.x - 2 * buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .2},
size = buttonSize,
trigger = 10
},
@@ -129,12 +127,12 @@ gui = {
guiType = GuiType.BUTTON,
buttonType = ButtonType.TRADE_OFFER,
name = 'Offer',
pos = {x = Pos.x + Size.x - buttonSize.x - margin.right, y = Pos.y + Size.y - buttonSize.y - margin.bottom, z = .2},
pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .2},
size = buttonSize,
trigger = 10
},
{
pos = {x = Pos.x + margin.left, y = Pos.y + Size.y - textboxSize.y - margin.bottom, z = .2},
pos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubSize.y - textboxSize.y - HubMargin.bottom, z = .2},
size = textboxSize,
guiType = GuiType.TEXTBOX,
}