Code: Select all
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = "90%",
height = width/2 --it doesnt work
})
Code: Select all
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = "90%",
height = width/2 --it doesnt work
})
Code: Select all
local width = "90%"
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = width,
height = width/2 --it doesnt work
})
Code: Select all
local width = "90%"
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = width,
height = (tonumber(string.match(width,"%d+"))/2).."%"
})
Code: Select all
local width = "90%"
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = width,
height = (tonumber(string.match(width,"%d+"))/1.5).."%"
})
Code: Select all
local labelName = "myLabel"
local maxWidth = "90%"
local maxHeight = "60%"
local aspectRatio = 1.5
function readjustWindowSize()
local main_w, main_h = getMainWindowSize()
local width, height = string.match(maxWidth,"%d+")*main_w/100, string.match(maxHeight,"%d+")*main_h/100
if width/aspectRatio < height then
height = width/aspectRatio
end
if height*aspectRatio < width then
width = height*aspectRatio
end
resizeWindow(labelName,width,height)
end
registerAnonymousEventHandler("sysWindowResizeEvent", "readjustWindowSize")
Code: Select all
--Map--
local labelName = "mapContainer"
local maxWidth = getMainWindowSize()
local maxHeight = maxWidth*0.7
local aspectRatio = 1.5
function readjustWindowSize()
local main_w, main_h = getMainWindowSize()
local width, height = string.match(maxWidth,"%d+")*main_w/100, string.match(maxHeight,"%d+")*main_h/100
echo("hello")
if width/aspectRatio < height then
height = width/aspectRatio
end
if height*aspectRatio < width then
width = height*aspectRatio
end
resizeWindow(labelName,width,height)
end
registerAnonymousEventHandler("sysWindowResizeEvent", "readjustWindowSize")
mapContainer = Geyser.Container:new({
name = "mapContainer",
x = 0,
y = 0,
width = "90%",
height = "60%"
})
mapBorders = Geyser.Label:new({
name = "mapBorders",
x = 0, y = 0,
width = "100%", height = "100%"
}, mapContainer)
mapBorders:setStyleSheet([[
background-color: red;
background-image : url(]]..ms_path..[[/images/background-01.png);
border-style: solid;
border-width: 21px;
border-image: url(]]..ms_path..[[/images/border2.png) 21 no-fill round round;
]]);
--Stary Swiat--
mapStarySwiatContainer = Geyser.Container:new({
name = "mapStarySwiatContainer",
x = 0,
y = 0,
width = "100%",
height = "100%"
}, mapContainer)
mapStarySwiat = Geyser.Label:new({
name = "mapStarySwiat",
x = 0, y = 0,
width = "100%", height = "100%"
}, mapStarySwiatContainer)
mapStarySwiat:setStyleSheet([[
background-color: transparent;
border-image : url(]]..ms_path..[[/images/worldmap.png);
margin: 83px 21px 21px 21px;
]]);
--/Stary Swiat--
mapCornerTL = Geyser.Label:new({
x = 0, y = 0,
width = 93, height = 92
}, mapContainer)
mapCornerTL:setStyleSheet([[
background-color: transparent;
background-image : url(]]..ms_path..[[/images/corner-tl.png);
background-repeat: no-repeat;
]]);
mapCornerTR = Geyser.Label:new({
x = -93, y = 0,
width = 93, height = 92
}, mapContainer)
mapCornerTR:setStyleSheet([[
background-color: transparent;
background-image : url(]]..ms_path..[[/images/corner-tr.png);
background-repeat: no-repeat;
]]);
mapCornerBL = Geyser.Label:new({
x = 0, y = -92,
width = 93, height = 92
}, mapContainer)
mapCornerBL:setStyleSheet([[
background-color: transparent;
background-image : url(]]..ms_path..[[/images/corner-bl.png);
background-repeat: no-repeat;
]]);
mapCornerBR = Geyser.Label:new({
x = -93, y = -92,
width = 93, height = 92
}, mapContainer)
mapCornerBR:setStyleSheet([[
background-color: transparent;
background-image : url(]]..ms_path..[[/images/corner-br.png);
background-repeat: no-repeat;
]]);
mapSubH = Geyser.Label:new({
x = 0, y = 78,
width = "100%", height = 7
}, mapContainer)
mapSubH:setStyleSheet([[
background-color: transparent;
background-image : url(]]..ms_path..[[/images/sub-h.png);
border-left: 20px solid transparent;
border-right: 20px solid transparent;
]]);
-- Buttons --
mapBtnExit = Geyser.Label:new({
name = "mapBtnExit",
x = -27, y = 0,
width = 27, height = 27
}, mapContainer)
mapBtnExit:setStyleSheet([[
QLabel{
background-color: transparent;
background-image : url(]]..ms_path..[[/images/btn-exit.png);
}
QLabel:hover{
background-image : url(]]..ms_path..[[/images/btn-exit-hover.png);
}
]]);
mapBtnStarySwiat = Geyser.Label:new({
name = "mapBtnStarySwiat",
x = 45, y = 31,
width = 175, height = 35,
fgColor = btn_font_color,
fontSize = 10,
message = [[<center>Stary Swiat</center>]]
}, mapContainer)
mapBtnStarySwiat:setStyleSheet([[
QLabel{
background-color: transparent;
background-image : url(]]..ms_path..[[/images/btn-main.png);
text-transform: uppercase;
font-weight: 500;
}
QLabel:hover{
background-image : url(]]..ms_path..[[/images/btn-main-hover.png);
}
]]);
mapBtnIshtar = Geyser.Label:new({
name = "mapBtnIshtar",
x = 225, y = 31,
width = 175, height = 35,
fgColor = btn_font_color,
fontSize = 10,
message = [[<center>Ishtar</center>]]
}, mapContainer)
mapBtnIshtar:setStyleSheet([[
QLabel{
background-color: transparent;
background-image : url(]]..ms_path..[[/images/btn-main.png);
text-transform: uppercase;
font-weight: 500;
}
QLabel:hover{
background-image : url(]]..ms_path..[[/images/btn-main-hover.png);
}
]]);
Code: Select all
--Map--
local maxWidth, maxHeight = getMainWindowSize()
local mapContainerAspectRatio = 1.5
maxWidth = maxWidth*0.9
maxHeight = maxWidth/mapContainerAspectRatio
function resizeMapContainer()
local getWidth, getHeight = getMainWindowSize()
maxWidth = getWidth*0.9
maxHeight = maxWidth/mapContainerAspectRatio
if maxHeight > getHeight*0.9 then
maxHeight = getHeight*0.9
maxWidth = maxHeight*mapContainerAspectRatio
end
mapContainer:resize(maxWidth, maxHeight)
end
registerAnonymousEventHandler("sysWindowResizeEvent", "resizeMapContainer")