mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
display window on screen center
This commit is contained in:
@@ -8,8 +8,14 @@ function Client.init()
|
||||
if g_window.getPlatformType() == "X11-EGL" then
|
||||
g_window.setFullscreen(true)
|
||||
else
|
||||
g_window.move({ x=220, y=220 })
|
||||
g_window.resize({ width=800, height=480 })
|
||||
local size = { width = 1024,
|
||||
height = 768 }
|
||||
g_window.resize(size)
|
||||
|
||||
local displaySize = g_window.getDisplaySize()
|
||||
local pos = { x = (displaySize.width - size.width)/2,
|
||||
y = (displaySize.height - size.height)/2 }
|
||||
g_window.move(pos)
|
||||
end
|
||||
|
||||
g_window.setTitle('OTClient')
|
||||
|
@@ -35,8 +35,6 @@ PopupMenuSeparator < UIWidget
|
||||
|
||||
PopupMenu < UIPopupMenu
|
||||
width: 100
|
||||
button-style: PopupMenuButton
|
||||
separator-style: PopupMenuSeparator
|
||||
border-image:
|
||||
source: /core_styles/images/menubox.png
|
||||
border: 3
|
@@ -19,7 +19,7 @@ function UIPopupMenu.display(menu, pos)
|
||||
end
|
||||
|
||||
function UIPopupMenu.addOption(menu, optionName, optionCallback)
|
||||
local optionWidget = createWidget(menu.buttonStyle, menu)
|
||||
local optionWidget = createWidget(menu:getStyleName() .. 'Button', menu)
|
||||
local lastOptionWidget = menu:getLastChild()
|
||||
optionWidget.onClick = function()
|
||||
optionCallback()
|
||||
@@ -29,7 +29,7 @@ function UIPopupMenu.addOption(menu, optionName, optionCallback)
|
||||
end
|
||||
|
||||
function UIPopupMenu.addSeparator(menu)
|
||||
local separatorWidget = createWidget(menu.separatorStyle, separator)
|
||||
local separatorWidget = createWidget(menu:getStyleName() .. 'Separator', separator)
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
@@ -49,12 +49,3 @@ function UIPopupMenu.onKeyPress(menu, keyCode, keyText, keyboardModifiers)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function UIPopupMenu.onStyleApply(menu, style)
|
||||
if style['button-style'] then
|
||||
menu.buttonStyle = style['button-style']
|
||||
end
|
||||
if style['separator-style'] then
|
||||
menu.separatorStyle = style['separator-style']
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user