summaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
authorPaul Ouellette <oue.paul18@gmail.com>2019-02-18 16:04:43 -0500
committerParamat <paramat@users.noreply.github.com>2019-02-18 21:04:43 +0000
commit0ad96cc73f5498cf4ffe85afe1478066acfd377a (patch)
tree3abb4d684f57cf543b141d65c8be56d1f40b5782 /builtin/mainmenu
parent57517628f03632587f68b5e8a1e6c641be07e629 (diff)
downloadminetest-0ad96cc73f5498cf4ffe85afe1478066acfd377a.tar.gz
minetest-0ad96cc73f5498cf4ffe85afe1478066acfd377a.tar.bz2
minetest-0ad96cc73f5498cf4ffe85afe1478066acfd377a.zip
Update gamebar on tab enter (#8192)
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/init.lua5
-rw-r--r--builtin/mainmenu/tab_local.lua16
2 files changed, 11 insertions, 10 deletions
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index 8b8f3cd39..130c3e73c 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -144,7 +144,10 @@ local function init_globals()
tv_main:set_fixed_size(false)
if menustyle ~= "simple" then
- tv_main:set_tab(core.settings:get("maintab_LAST"))
+ local last_tab = core.settings:get("maintab_LAST")
+ if last_tab and tv_main.current_tab ~= last_tab then
+ tv_main:set_tab(last_tab)
+ end
end
ui.set_default("maintab")
tv_main:show()
diff --git a/builtin/mainmenu/tab_local.lua b/builtin/mainmenu/tab_local.lua
index 915258b48..15ef96dc8 100644
--- a/builtin/mainmenu/tab_local.lua
+++ b/builtin/mainmenu/tab_local.lua
@@ -294,13 +294,6 @@ end
local on_change
if enable_gamebar then
function on_change(type, old_tab, new_tab)
- local buttonbar = ui.find_by_name("game_button_bar")
-
- if ( buttonbar == nil ) then
- singleplayer_refresh_gamebar()
- buttonbar = ui.find_by_name("game_button_bar")
- end
-
if (type == "ENTER") then
local game = current_game()
@@ -309,10 +302,15 @@ if enable_gamebar then
core.set_topleft_text(game.name)
mm_texture.update("singleplayer",game)
end
- buttonbar:show()
+
+ singleplayer_refresh_gamebar()
+ ui.find_by_name("game_button_bar"):show()
else
menudata.worldlist:set_filtercriteria(nil)
- buttonbar:hide()
+ local gamebar = ui.find_by_name("game_button_bar")
+ if gamebar then
+ gamebar:hide()
+ end
core.set_topleft_text("")
mm_texture.update(new_tab,nil)
end