mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Merge pull request #907 from diath/topbar_visibility_toggle
Add a keyboard shortcut to toggle topmenu visibility
This commit is contained in:
@@ -51,6 +51,8 @@ function init()
|
||||
pingLabel = topMenu:getChildById('pingLabel')
|
||||
fpsLabel = topMenu:getChildById('fpsLabel')
|
||||
|
||||
g_keyboard.bindKeyDown('Ctrl+Shift+T', toggle)
|
||||
|
||||
if g_game.isOnline() then
|
||||
online()
|
||||
end
|
||||
@@ -164,3 +166,22 @@ end
|
||||
function getTopMenu()
|
||||
return topMenu
|
||||
end
|
||||
|
||||
function toggle()
|
||||
local menu = getTopMenu()
|
||||
if not menu then
|
||||
return
|
||||
end
|
||||
|
||||
if menu:isVisible() then
|
||||
menu:hide()
|
||||
modules.client_background.getBackground():addAnchor(AnchorTop, 'parent', AnchorTop)
|
||||
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'parent', AnchorTop)
|
||||
modules.game_interface.getShowTopMenuButton():show()
|
||||
else
|
||||
menu:show()
|
||||
modules.client_background.getBackground():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
|
||||
modules.game_interface.getRootPanel():addAnchor(AnchorTop, 'topMenu', AnchorBottom)
|
||||
modules.game_interface.getShowTopMenuButton():hide()
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user