Skip to content

Commit

Permalink
Add main_menu_style setting
Browse files Browse the repository at this point in the history
  • Loading branch information
PorygonZRocks authored and sfan5 committed Feb 8, 2018
1 parent 87e08b1 commit 0e4c467
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
14 changes: 9 additions & 5 deletions builtin/mainmenu/init.lua
Expand Up @@ -24,6 +24,10 @@ mt_color_dark_green = "#25C191"

local menupath = core.get_mainmenu_path()
local basepath = core.get_builtin_path()
local menustyle = core.settings:get("main_menu_style")
if menustyle == "auto" then
menustyle = PLATFORM == "Android" and "simple" or "full"
end
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM

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

dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
if PLATFORM ~= "Android" then
if menustyle ~= "simple" then
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_mod.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
Expand All @@ -52,7 +56,7 @@ local tabs = {}
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
tabs.mods = dofile(menupath .. DIR_DELIM .. "tab_mods.lua")
tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
if PLATFORM == "Android" then
if menustyle == "simple" then
tabs.simple_main = dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
else
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
Expand All @@ -73,7 +77,7 @@ local function init_globals()
-- Init gamedata
gamedata.worldindex = 0

if PLATFORM == "Android" then
if menustyle == "simple" then
local world_list = core.get_worlds()
local world_index

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

if PLATFORM == "Android" then
if menustyle == "simple" then
tv_main:add(tabs.simple_main)
tv_main:add(tabs.settings)
else
Expand All @@ -145,7 +149,7 @@ local function init_globals()
tv_main:set_global_event_handler(main_event_handler)
tv_main:set_fixed_size(false)

if PLATFORM ~= "Android" then
if menustyle ~= "simple" then
tv_main:set_tab(core.settings:get("maintab_LAST"))
end
ui.set_default("maintab")
Expand Down
4 changes: 0 additions & 4 deletions builtin/mainmenu/init_simple.lua

This file was deleted.

6 changes: 6 additions & 0 deletions builtin/settingtypes.txt
Expand Up @@ -1241,6 +1241,12 @@ curl_file_download_timeout (cURL file download timeout) int 300000
# Makes DirectX work with LuaJIT. Disable if it causes troubles.
high_precision_fpu (High-precision FPU) bool true

# Changes the main menu UI:
# - Full: Multple singleplayer worlds, subgame choice, texture pack chooser, etc.
# - Simple: One singleplayer world, no subgame or texture pack choosers. May be necessary for smaller screens.
# - Auto: Simple on Android, full on everything else.
main_menu_style (Main menu style) enum auto auto,full,simple

# Replaces the default main menu with a custom one.
main_menu_script (Main menu script) string

Expand Down
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Expand Up @@ -255,6 +255,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("joystick_frustum_sensitivity", "170");

// Main menu
settings->setDefault("main_menu_style", "auto");
settings->setDefault("main_menu_path", "");
settings->setDefault("main_menu_mod_mgr", "1");
settings->setDefault("main_menu_game_mgr", "0");
Expand Down

0 comments on commit 0e4c467

Please sign in to comment.