Skip to content

Commit 0e4c467

Browse files
PorygonZRockssfan5
PorygonZRocks
authored andcommittedFeb 8, 2018
Add main_menu_style setting
1 parent 87e08b1 commit 0e4c467

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed
 

Diff for: ‎builtin/mainmenu/init.lua

+9-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ mt_color_dark_green = "#25C191"
2424

2525
local menupath = core.get_mainmenu_path()
2626
local basepath = core.get_builtin_path()
27+
local menustyle = core.settings:get("main_menu_style")
28+
if menustyle == "auto" then
29+
menustyle = PLATFORM == "Android" and "simple" or "full"
30+
end
2731
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
2832
DIR_DELIM .. "pack" .. DIR_DELIM
2933

@@ -40,7 +44,7 @@ dofile(menupath .. DIR_DELIM .. "textures.lua")
4044

4145
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
4246
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
43-
if PLATFORM ~= "Android" then
47+
if menustyle ~= "simple" then
4448
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
4549
dofile(menupath .. DIR_DELIM .. "dlg_delete_mod.lua")
4650
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
@@ -52,7 +56,7 @@ local tabs = {}
5256
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
5357
tabs.mods = dofile(menupath .. DIR_DELIM .. "tab_mods.lua")
5458
tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
55-
if PLATFORM == "Android" then
59+
if menustyle == "simple" then
5660
tabs.simple_main = dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
5761
else
5862
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
@@ -73,7 +77,7 @@ local function init_globals()
7377
-- Init gamedata
7478
gamedata.worldindex = 0
7579

76-
if PLATFORM == "Android" then
80+
if menustyle == "simple" then
7781
local world_list = core.get_worlds()
7882
local world_index
7983

@@ -128,7 +132,7 @@ local function init_globals()
128132
-- Create main tabview
129133
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
130134

131-
if PLATFORM == "Android" then
135+
if menustyle == "simple" then
132136
tv_main:add(tabs.simple_main)
133137
tv_main:add(tabs.settings)
134138
else
@@ -145,7 +149,7 @@ local function init_globals()
145149
tv_main:set_global_event_handler(main_event_handler)
146150
tv_main:set_fixed_size(false)
147151

148-
if PLATFORM ~= "Android" then
152+
if menustyle ~= "simple" then
149153
tv_main:set_tab(core.settings:get("maintab_LAST"))
150154
end
151155
ui.set_default("maintab")

Diff for: ‎builtin/mainmenu/init_simple.lua

-4
This file was deleted.

Diff for: ‎builtin/settingtypes.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,12 @@ curl_file_download_timeout (cURL file download timeout) int 300000
12411241
# Makes DirectX work with LuaJIT. Disable if it causes troubles.
12421242
high_precision_fpu (High-precision FPU) bool true
12431243

1244+
# Changes the main menu UI:
1245+
# - Full: Multple singleplayer worlds, subgame choice, texture pack chooser, etc.
1246+
# - Simple: One singleplayer world, no subgame or texture pack choosers. May be necessary for smaller screens.
1247+
# - Auto: Simple on Android, full on everything else.
1248+
main_menu_style (Main menu style) enum auto auto,full,simple
1249+
12441250
# Replaces the default main menu with a custom one.
12451251
main_menu_script (Main menu script) string
12461252

Diff for: ‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ void set_default_settings(Settings *settings)
255255
settings->setDefault("joystick_frustum_sensitivity", "170");
256256

257257
// Main menu
258+
settings->setDefault("main_menu_style", "auto");
258259
settings->setDefault("main_menu_path", "");
259260
settings->setDefault("main_menu_mod_mgr", "1");
260261
settings->setDefault("main_menu_game_mgr", "0");

0 commit comments

Comments
 (0)
Please sign in to comment.