1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add new setting to enable/disable dark mode in main menu. Add core funcs to set sky/cloud colors

This commit is contained in:
Zenon Seth 2025-06-07 22:05:38 +01:00
parent aba2b6638e
commit 8d6d1ff6ac
13 changed files with 119 additions and 35 deletions

View file

@ -37,12 +37,16 @@ function mm_game_theme.set_engine(hide_decorations)
mm_game_theme.set_engine_single("footer")
end
if core.settings:get_bool("menu_dark_theme") then
core.set_clouds_color("#1c2a47")
core.set_sky_color("#090b1a")
else
core.set_clouds_color("#f0f0ff")
core.set_sky_color("#8cbafa")
end
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_game_theme.set_dirt_bg()
end
core.set_clouds(core.settings:get_bool("menu_clouds"))
end
end
@ -72,12 +76,16 @@ function mm_game_theme.set_game(gamedetails)
mm_game_theme.set_game_single("header", gamedetails)
mm_game_theme.set_game_single("footer", gamedetails)
if core.settings:get_bool("menu_dark_theme") then
core.set_clouds_color("#1c2a47")
core.set_sky_color("#090b1a")
else
core.set_clouds_color("#f0f0ff")
core.set_sky_color("#8cbafa")
end
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_game_theme.set_dirt_bg()
end
core.set_clouds(core.settings:get_bool("menu_clouds"))
end
end
@ -145,20 +153,6 @@ function mm_game_theme.set_game_single(identifier, gamedetails)
return false
end
--------------------------------------------------------------------------------
function mm_game_theme.set_dirt_bg()
if mm_game_theme.texturepack ~= nil then
local path = mm_game_theme.texturepack .. DIR_DELIM .."default_dirt.png"
if core.set_background("background", path, true, 128) then
return true
end
end
-- Use universal fallback texture in textures/base/pack
local minimalpath = defaulttexturedir .. "menu_bg.png"
core.set_background("background", minimalpath, true, 128)
end
--------------------------------------------------------------------------------
function mm_game_theme.stop_music()
if mm_game_theme.music_handle ~= nil then

View file

@ -871,6 +871,9 @@ tooltip_append_itemname (Append item name) bool false
# Use a cloud animation for the main menu background.
menu_clouds (Clouds in menu) bool true
# Use dark theme for the main menu background
menu_dark_theme (Menu dark theme) bool true
[**HUD]
# Modifies the size of the HUD elements.