Update MainMenu look

master
Maksim 2022-02-27 21:33:33 +01:00
parent 6950a3b9a1
commit 3b200d6e48
49 changed files with 501 additions and 198 deletions

View File

@ -74,7 +74,8 @@ function messagebox(name, message)
function()
return ([[
size[12,5.4,false]
background[0,0;0,0;%s;true;32]
bgcolor[#0000]
background9[0,0;14,8;%s;true;40]
textarea[1,1;10,4;;;%s]
button[5,4.5;2,0.8;ok;%s]
]]):format(bg, message, fgettext("OK"))

View File

@ -56,36 +56,30 @@ local function add_tab(self,tab)
end
end
local function get_bg(tsize, tabname)
local bg =
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]"
if tabname then
bg = bg ..
"background[0,0;" .. tsize.width .. "," .. tsize.height .. ";" ..
core.formspec_escape(defaulttexturedir ..
"bg_" .. tabname .. ".png") .. ";true]"
end
return bg
end
--------------------------------------------------------------------------------
local function get_formspec(self)
local formspec = ""
if not self.hidden and (self.parent == nil or not self.parent.hidden) then
local name = self.tablist[self.last_tab_index].name
local tabname = (name == "local" or name == "online") and name
or (name == "local_default" and "local")
if self.parent == nil then
local tsize = self.tablist[self.last_tab_index].tabsize or
{width=self.width, height=self.height}
local defaulttexturedir = core.formspec_escape(defaulttexturedir)
formspec = formspec ..
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
dump(self.fixed_size)) .. get_bg(tsize, tabname)
dump(self.fixed_size)) ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. defaulttexturedir .. "bg_common.png;true;40]" ..
"style[settings_tab;content_offset=0]" ..
"image_button[12.02,1.3;1,1.55;" ..
defaulttexturedir .. "settings_menu.png;settings_tab;;true;false;" ..
defaulttexturedir .. "settings_menu_pressed.png]" ..
"style[authors_tab;content_offset=0]" ..
"image_button[12.02,2.7;1,1.55;" ..
defaulttexturedir .. "authors_menu.png;authors_tab;;true;false;" ..
defaulttexturedir .. "authors_menu_pressed.png]"
end
formspec = formspec .. self:tab_header()
formspec = formspec ..
@ -99,6 +93,7 @@ local function get_formspec(self)
return formspec
end
local set_tab_by_name
--------------------------------------------------------------------------------
local function handle_buttons(self,fields)
@ -115,6 +110,14 @@ local function handle_buttons(self,fields)
return true
end
if fields.authors_tab then
set_tab_by_name(self, "credits")
return true
elseif fields.settings_tab then
set_tab_by_name(self, "settings")
return true
end
if self.tablist[self.last_tab_index].button_handler ~= nil then
return
self.tablist[self.last_tab_index].button_handler(
@ -208,7 +211,8 @@ local function handle_tab_buttons(self,fields)
end
--------------------------------------------------------------------------------
local function set_tab_by_name(self, name)
-- Declared as a local variable above handle_buttons
function set_tab_by_name(self, name)
for i=1,#self.tablist,1 do
if self.tablist[i].name == name then
switch_to_tab(self, i)

View File

@ -88,8 +88,9 @@ function ui.update()
formspec = {
"formspec_version[3]",
"size[14,8.25]",
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]",
"bgcolor[#0000]",
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]",
"box[0.5,1.2;13,5;#000]",
("textarea[0.5,1.2;13,5;;%s;%s]"):format(
fgettext("The server has requested a reconnect:"), error_message),
@ -108,7 +109,7 @@ function ui.update()
end
local restart_btn = "button[5,6.6;4,1;btn_reconnect_no;" .. fgettext("Close") .. "]"
if maintab == "local" or maintab == "local_default" and
connect_time and connect_time < os.time() - 30 then
connect_time and os.time() - connect_time > 30 then
restart_btn =
"button[2,6.6;4,1;btn_reconnect_yes;" .. fgettext("Restart") .. "]" ..
"button[8,6.6;4,1;btn_reconnect_no;" .. fgettext("Close") .. "]"
@ -116,8 +117,9 @@ function ui.update()
formspec = {
"formspec_version[3]",
"size[14,8.25]",
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]",
"bgcolor[#0000]",
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]",
"box[0.5,1.2;13,5;#000]",
("textarea[0.5,1.2;13,5;;%s;%s]"):format(
error_title, error_message),

View File

@ -99,7 +99,7 @@ function render_serverlist_row(spec, is_favorite)
details = details .. "11,"
end
else
details = details .. "0,"
details = details .. "11,"
end
if spec.clients and spec.clients_max then

View File

@ -70,8 +70,9 @@ local function get_formspec(data)
local retval =
"size[11.5,7.5,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"label[0.5,0;" .. fgettext("World:") .. "]" ..
"label[1.75,0;" .. data.worldspec.name .. "]"

View File

@ -702,8 +702,9 @@ function store.get_formspec(dlgdata)
formspec = {
"formspec_version[3]",
"size[15.75,9.5;false]",
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]",
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]",
"position[0.5,0.55]",
"style[status,downloading,queued;border=false]",
@ -769,8 +770,9 @@ function store.get_formspec(dlgdata)
else
formspec = {
"size[12,7;false]",
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]",
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]",
"position[0.5,0.55]",
"label[4,3;", fgettext("No packages could be retrieved"), "]",
"container[0,", H - 0.8 - 0.375, "]",

View File

@ -98,8 +98,9 @@ local function create_world_formspec(dialogdata)
-- Error out when no games found
if #pkgmgr.games == 0 then
return "size[12.25,3,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"box[0,0;12,2;#ff8800]" ..
"textarea[0.3,0;11.7,2;;;"..
fgettext("You have no games installed.") .. "\n" ..
@ -134,7 +135,7 @@ local function create_world_formspec(dialogdata)
end
end
local game_by_gameidx = pkgmgr.get_game_no_default(gameidx)
local game_by_gameidx = core.get_game(gameidx)
local disallowed_mapgen_settings = {}
if game_by_gameidx ~= nil then
local gamepath = game_by_gameidx.path
@ -318,10 +319,16 @@ local function create_world_formspec(dialogdata)
gamelist_height = 0.5
end
local _gameidx = gameidx
if _gameidx >= pkgmgr.default_game_idx then
_gameidx = _gameidx - 1
end
local retval =
"size[12.25,7,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
-- Left side
"container[0,0]"..
@ -338,7 +345,7 @@ local function create_world_formspec(dialogdata)
"label[0,3.35;" .. fgettext("Game") .. "]"..
"textlist[0,3.85;5.8,"..gamelist_height..";games;" ..
pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" ..
pkgmgr.gamelist() .. ";" .. _gameidx .. ";false]" ..
"container[0,4.5]" ..
devtest_only ..
"container_end[]" ..
@ -351,6 +358,7 @@ local function create_world_formspec(dialogdata)
"container_end[]"..
-- Menu buttons
"style[world_create_confirm;bgcolor=#00d12b]" ..
"button[3.25,6.5;3,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[6.25,6.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
@ -367,7 +375,11 @@ local function create_world_buttonhandler(this, fields)
local gameindex = core.get_textlist_index("games")
if gameindex ~= nil then
-- For unnamed worlds use the generated name 'world<number>',
if gameindex >= pkgmgr.default_game_idx then
gameindex = gameindex + 1
end
-- For unnamed worlds use the generated name 'World <number>',
-- where the number increments: it is set to 1 larger than the largest
-- generated name number found.
if worldname == "" then
@ -386,7 +398,7 @@ local function create_world_buttonhandler(this, fields)
local message
if not menudata.worldlist:uid_exists_raw(worldname) then
core.settings:set("mg_name",fields["dd_mapgen"])
message = pkgmgr.create_world_no_default(worldname,gameindex)
message = core.create_world(worldname,gameindex)
else
message = fgettext("A world named \"$1\" already exists", worldname)
end
@ -414,6 +426,9 @@ local function create_world_buttonhandler(this, fields)
if fields["games"] then
local gameindex = core.get_textlist_index("games")
if gameindex >= pkgmgr.default_game_idx then
gameindex = gameindex + 1
end
core.settings:set("menu_last_game", pkgmgr.games[gameindex].id)
return true
end

View File

@ -61,21 +61,22 @@ local function create_world_formspec()
mglist = mglist:sub(1, -2)
local retval =
"size[12,6,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"label[1.5,1.2;" .. fgettext("World name") .. ":" .. "]"..
"field[4.5,1.5;6,0.5;te_world_name;;]" ..
"size[12,5.4,false]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"label[1.5,0.9;" .. fgettext("World name") .. ":" .. "]"..
"field[4.5,1.2;6,0.5;te_world_name;;]" ..
"label[1.5,2.2;" .. fgettext("Seed") .. ":" .. "]"..
"field[4.5,2.5;6,0.5;te_seed;;".. current_seed .. "]" ..
"label[1.5,1.9;" .. fgettext("Seed") .. ":" .. "]"..
"field[4.5,2.2;6,0.5;te_seed;;".. current_seed .. "]" ..
"label[1.5,3.2;" .. fgettext("Mapgen") .. ":" .. "]"..
"dropdown[4.2,3.05;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
"label[1.5,2.9;" .. fgettext("Mapgen") .. ":" .. "]"..
"dropdown[4.2,2.75;6.3;dd_mapgen;" .. mglist .. ";" .. selindex .. "]" ..
"style[world_create_confirm;bgcolor=#00d12b]" ..
"button[3.5,4.8;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[6,4.8;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
"button[3.5,4.4;2.5,0.5;world_create_confirm;" .. fgettext("Create") .. "]" ..
"button[6,4.4;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
return retval

View File

@ -19,14 +19,15 @@
local function delete_content_formspec(dialogdata)
local retval =
"size[11.5,4.5,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"size[12,5.4,false]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"label[2,2;" ..
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name) .. "]"..
"style[dlg_delete_content_confirm;bgcolor=red]" ..
"button[3.25,3.5;2.5,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
"button[5.75,3.5;2.5,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
"button[3,4.8;3,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
"button[6,4.8;3,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
return retval
end

View File

@ -24,15 +24,16 @@ local function delete_world_formspec(dialogdata)
end
local retval =
"size[12,4,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"image_button[2,0.5;8,2;" .. core.formspec_escape(defaulttexturedir ..
"size[12,5.4,false]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"image_button[2,1;8,3;" .. core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";;" .. fgettext("Delete World \"$1\"?", delete_name) ..
";true;false;]" ..
"style[world_delete_confirm;bgcolor=red]" ..
"button[3.5,2.8;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
"button[6,2.8;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
"button[3,4.8;3,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
"button[6,4.8;3,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
return retval
end

View File

@ -19,12 +19,13 @@
local function rename_modpack_formspec(dialogdata)
local retval =
"size[11.5,4.5,false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"button[3.25,3.5;2.5,0.5;dlg_rename_modpack_confirm;"..
"size[12,5.4,false]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"button[3,4.8;3,0.5;dlg_rename_modpack_confirm;"..
fgettext("Accept") .. "]" ..
"button[5.75,3.5;2.5,0.5;dlg_rename_modpack_cancel;"..
"button[3,4.8;3,0.5;dlg_rename_modpack_cancel;"..
fgettext("Cancel") .. "]"
local input_y = 2

View File

@ -788,8 +788,9 @@ local function create_change_setting_formspec(dialogdata)
return (
"size[" .. width .. "," .. height + 0.25 .. ",false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
create_textfield(description_box, setting_name, comment_text) ..
formspec ..
"button[" .. width / 2 - 2.5 .. "," .. height - 0.4 .. ";2.5,1;btn_done;" ..
@ -952,8 +953,9 @@ end
local function create_settings_formspec(tabview, _, tabdata)
local formspec = "size[12,5.4;false]" ..
"background[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;32]" ..
"bgcolor[#0000]" ..
"background9[0,0;0,0;" .. core.formspec_escape(defaulttexturedir ..
"bg_common.png") .. ";true;40]" ..
"tablecolumns[color;tree;text,width=28;text]" ..
"tableoptions[background=#00000000;border=false]" ..
"field[0.3,0.1;10.2,1;search_string;;" .. core.formspec_escape(search_string) .. "]" ..

View File

@ -55,6 +55,8 @@ local tabs = {}
if not mobile then
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
else
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings_simple.lua")
end
tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
@ -62,13 +64,7 @@ tabs.local_default_game = dofile(menupath .. DIR_DELIM .. "tab_local_default.lua
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
local htabs = {}
local hpath = menupath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua"
local hosting = io.open(hpath, "r")
if hosting then
htabs = dofile(hpath)
io.close(hosting)
end
local func = loadfile(menupath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua")
--------------------------------------------------------------------------------
local function main_event_handler(tabview, event)
@ -79,7 +75,7 @@ local function main_event_handler(tabview, event)
end
--------------------------------------------------------------------------------
local function init_globals()
function menudata.init_tabs()
-- Init gamedata
gamedata.worldindex = 0
@ -107,7 +103,7 @@ local function init_globals()
mm_texture.init()
-- Create main tabview
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0.1, y = 0})
for i = 1, #pkgmgr.games do
if pkgmgr.games[i].id == "default" then
@ -123,26 +119,28 @@ local function init_globals()
end
end
for _, page in pairs(htabs) do
tv_main:add(page)
if func then
func(tv_main)
end
tv_main:add(tabs.play_online)
if not mobile then
tv_main:set_autosave_tab(true)
tv_main:add(tabs.content)
tv_main:add(tabs.settings)
end
tv_main:add(tabs.settings)
tv_main:add(tabs.credits)
tv_main:set_autosave_tab(true)
tv_main:set_global_event_handler(main_event_handler)
tv_main:set_fixed_size(false)
if not mobile then
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
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
if last_tab ~= "local" and not core.settings:get_bool("menu_clouds") then
mm_texture.set_dirt_bg()
end
-- In case the folder of the last selected game has been deleted,
@ -157,10 +155,9 @@ local function init_globals()
ui.set_default("maintab")
tv_main:show()
core.set_clouds(false)
mm_texture.set_dirt_bg()
core.set_clouds(core.settings:get_bool("menu_clouds"))
ui.update()
end
init_globals()
menudata.init_tabs()

View File

@ -901,29 +901,14 @@ function pkgmgr.get_game(index)
end
--------------------------------------------------------------------------------
local default_game_idx
function pkgmgr.get_game_no_default(index)
if default_game_idx and index >= default_game_idx then
index = index + 1
end
return pkgmgr.get_game(index)
end
function pkgmgr.create_world_no_default(worldname, gameindex)
if default_game_idx and gameindex >= default_game_idx then
gameindex = gameindex + 1
end
return core.create_world(worldname, gameindex)
end
--------------------------------------------------------------------------------
pkgmgr.default_game_idx = math.huge
function pkgmgr.update_gamelist()
pkgmgr.games = core.get_games()
-- Update default_game_idx
for i, game in ipairs(pkgmgr.games) do
if game.id == "default" then
default_game_idx = i
pkgmgr.default_game_idx = i
break
end
end

View File

@ -18,14 +18,14 @@
--------------------------------------------------------------------------------
local multicraft_developers = {
"Maksim Gamarnik (MoNTE48) <MoNTE48@mail.ua>",
"Maksim Gamarnik (MoNTE48) <Maksym48@pm.me>",
"Bektur Mambetov (ubulem) <berkut87@gmail.com>",
"Alexander Zavrin (Ransom.00)",
"luk3yx",
"Nathan Salapat (NathanS21) <nathan@nathansalapat.com>",
"Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"An0n3m0us",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"sfan5 <sfan5@live.de>",
"Stuart Jones (stujones11) <stujones111@gmail.com>",
"And other people who helped make the world better!"
@ -112,19 +112,21 @@ end
return {
name = "credits",
caption = fgettext("Credits"),
caption = "", -- fgettext("Credits"),
cbf_formspec = function(tabview, name, tabdata)
local version = core.get_version()
local fs = "label[0.1,-0.2;" ..
local fs = "label[0.05,-0.2;" ..
"MultiCraft Open Source, ver. " .. version.string .. "\n" ..
"Copyright (C) 2014-2021 MultiCraft Development Team\n" ..
"Copyright (C) 2014-2022 MultiCraft Development Team\n" ..
"License: GNU LGPLv3.0+ and CC BY-SA 4.0\n" ..
"Created and Powered by Minetest Engine, ver. 5.4.1]" ..
"button[9.5,0;2.5,0.5;homepage;Home Page]" ..
"button[9.5,0.8;2.5,0.5;privacy;Privacy Policy]" ..
"background9[0.1,1.5;11.85,4.15;" ..
core.formspec_escape(defaulttexturedir) .. "worldlist_bg.png" .. ";false;40]" ..
"tablecolumns[color;text]" ..
"tableoptions[background=#999999;highlight=#00000000;border=true]" ..
"table[0,1.5;11.8,4;list_credits;" ..
"tableoptions[background=#0000;highlight=#00000000;border=false]" ..
"table[0.1,1.5;11.65,4;list_credits;" ..
"#FFFF00," .. fgettext("MultiCraft Developers") .. ",," ..
buildCreditList(multicraft_developers) .. ",,," ..
"#FFFF00," .. fgettext("Minetest Developers") .. ",," ..
@ -134,8 +136,7 @@ return {
"#FFFF00," .. fgettext("Previous Core Developers") ..",," ..
buildCreditList(previous_core_developers) .. ",,," ..
"#FFFF00," .. fgettext("Previous Contributors") .. ",," ..
buildCreditList(previous_contributors) .. "," ..
";1]"
buildCreditList(previous_contributors) .. ";1]"
--[[if PLATFORM ~= "Android" then
fs = fs .. "tooltip[userdata;" ..

View File

@ -19,6 +19,8 @@ local lang = core.settings:get("language")
if not lang or lang == "" then lang = os.getenv("LANG") end
local mobile = PLATFORM == "Android" or PLATFORM == "iOS"
local esc = core.formspec_escape
local function current_game()
local last_game_id = core.settings:get("menu_last_game")
local game = pkgmgr.find_by_gameid(last_game_id)
@ -77,11 +79,11 @@ local function singleplayer_refresh_gamebar()
local image = nil
local text = nil
local tooltip = core.formspec_escape(pkgmgr.games[i].name)
local tooltip = esc(pkgmgr.games[i].name)
if pkgmgr.games[i].menuicon_path ~= nil and
pkgmgr.games[i].menuicon_path ~= "" then
image = core.formspec_escape(pkgmgr.games[i].menuicon_path)
image = esc(pkgmgr.games[i].menuicon_path)
else
local part1 = pkgmgr.games[i].id:sub(1,5)
local part2 = pkgmgr.games[i].id:sub(6,10)
@ -99,7 +101,7 @@ local function singleplayer_refresh_gamebar()
end
if not mobile then
local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png")
local plus_image = esc(defaulttexturedir .. "plus.png")
btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB"))
end
end
@ -124,8 +126,11 @@ local function get_formspec()
local index = filterlist.get_current_index(menudata.worldlist,
tonumber(core.settings:get("mainmenu_last_selected_world")))
-- Default index
if index == 0 then index = 1 end
local creative_checkbox = core.settings:get_bool("creative_mode") and
"creative_checkbox" or "blank"
"creative_checkbox.png" or "blank.png"
local creative_bg = "creative_bg.png"
if lang and lang == "ru" then
@ -133,32 +138,33 @@ local function get_formspec()
end
local retval =
"image_button[0,4.84;3.31,0.92;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";world_delete;;true;false]" ..
"style[world_delete;fgimg=" .. esc(defaulttexturedir .. "world_delete.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "world_delete_hover.png") .. "]" ..
"image_button[-0.1,4.84;3.45,0.92;;world_delete;;true;false]" ..
"tooltip[world_delete;".. fgettext("Delete") .. "]" ..
"image_button[3.14,4.84;3.3,0.92;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";world_create;;true;false]" ..
"style[world_create;fgimg=" .. esc(defaulttexturedir .. "world_new.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "world_new_hover.png") .. "]" ..
"image_button[3.15,4.84;3.45,0.92;;world_create;;true;false]" ..
"tooltip[world_create;".. fgettext("New") .. "]" ..
"button[9.5,4.8;2.5,1;world_configure;".. fgettext("Configure") .. "]" ..
"image_button[6.72,1.43;4.96,1.41;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";play;;true;false]" ..
"style[play;fgimg=" .. esc(defaulttexturedir .. "btn_play.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "btn_play_hover.png") .. "]" ..
"image_button[6.72,1.43;4.96,1.41;;play;;true;false]" ..
"tooltip[play;".. fgettext("Play Game") .. "]" ..
"image_button[7.2,3.09;4,0.83;" ..
core.formspec_escape(defaulttexturedir) .. creative_bg ..
";;;true;false]" ..
esc(defaulttexturedir) .. creative_bg .. ";;;true;false]" ..
"image_button[7.2,3.09;4,0.83;" ..
core.formspec_escape(defaulttexturedir) .. creative_checkbox ..
".png;cb_creative_mode;;true;false]" ..
esc(defaulttexturedir) .. creative_checkbox .. ";cb_creative_mode;;true;false]" ..
"tableoptions[background=#27233F;border=false]" ..
"table[-0.01,0;6.28,4.64;sp_worlds;" ..
menu_render_worldlist() ..
";" .. index .. "]"
"background9[0,0;6.5,4.8;" ..
esc(defaulttexturedir) .. "worldlist_bg.png" .. ";false;40]" ..
"tableoptions[background=#0000;border=false]" ..
"table[0,0;6.28,4.64;sp_worlds;" ..
menu_render_worldlist() .. ";" .. index .. "]"
if PLATFORM ~= "Android" and PLATFORM ~= "iOS" then
@ -176,7 +182,7 @@ local function get_formspec()
"label[6.6,-0.3;" .. fgettext("Name") .. ":" .. "]" ..
"label[9.3,-0.3;" .. fgettext("Password") .. ":" .. "]" ..
"field[6.9,0.6;2.8,0.5;te_playername;;" ..
core.formspec_escape(core.settings:get("name")) .. "]" ..
esc(core.settings:get("name")) .. "]" ..
"pwdfield[9.6,0.6;2.8,0.5;te_passwd;]"
end

View File

@ -18,6 +18,8 @@
local lang = core.settings:get("language")
if not lang or lang == "" then lang = os.getenv("LANG") end
local esc = core.formspec_escape
local default_worlds = {
{name = "World 1", mg_name = "v7p", seed = "15823438331521897617"},
{name = "World 2", mg_name = "v7p", seed = "1841722166046826822"},
@ -73,12 +75,12 @@ local function get_formspec()
if selected ~= nil and selected < #menudata.worldlist:get_list() then
index = selected
else
index = #menudata.worldlist:get_list()
index = 1
end
end
local creative_checkbox = core.settings:get_bool("creative_mode") and
"creative_checkbox" or "blank"
"creative_checkbox.png" or "blank.png"
local creative_bg = "creative_bg.png"
if lang and lang == "ru" then
@ -86,32 +88,38 @@ local function get_formspec()
end
local retval =
"image_button[0,4.84;3.31,0.92;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";world_delete;;true;false]" ..
"style[world_delete;fgimg=" .. esc(defaulttexturedir .. "world_delete.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "world_delete_hover.png") .. "]" ..
"image_button[-0.1,4.84;3.45,0.92;;world_delete;;true;false]" ..
"tooltip[world_delete;".. fgettext("Delete") .. "]" ..
"image_button[3.14,4.84;3.3,0.92;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";world_create;;true;false]" ..
"style[world_create;fgimg=" .. esc(defaulttexturedir .. "world_new.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "world_new_hover.png") .. "]" ..
"image_button[3.15,4.84;3.45,0.92;;world_create;;true;false]" ..
"tooltip[world_create;".. fgettext("New") .. "]" ..
"image_button[6.72,1.43;4.96,1.41;" ..
core.formspec_escape(defaulttexturedir ..
"blank.png") .. ";play;;true;false]" ..
"style[play;fgimg=" .. esc(defaulttexturedir .. "btn_play.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "btn_play_hover.png") .. "]" ..
"image_button[6.72,1.43;4.96,1.41;;play;;true;false]" ..
"tooltip[play;".. fgettext("Play Game") .. "]" ..
"image_button[7.2,3.09;4,0.83;" ..
core.formspec_escape(defaulttexturedir) .. creative_bg ..
";;;true;false]" ..
esc(defaulttexturedir) .. creative_bg .. ";;;true;false]" ..
"image_button[7.2,3.09;4,0.83;" ..
core.formspec_escape(defaulttexturedir) .. creative_checkbox ..
".png;cb_creative_mode;;true;false]" ..
esc(defaulttexturedir) .. creative_checkbox .. ";cb_creative_mode;;true;false]" ..
"tableoptions[background=#27233F;border=false]" ..
"table[-0.01,0;6.28,4.64;sp_worlds;" ..
menu_render_worldlist() ..
";" .. index .. "]"
"background9[0,0;6.5,4.8;" ..
esc(defaulttexturedir) .. "worldlist_bg.png" .. ";false;40]" ..
"tableoptions[background=#0000;border=false]" ..
"table[0,0;6.28,4.64;sp_worlds;" ..
menu_render_worldlist() .. ";" .. index .. "]"
if PLATFORM == "Android" then
retval = retval ..
"image_button[10.6,-0.1;1.5,1.5;" ..
esc(defaulttexturedir) .. "gift_btn.png;upgrade;;true;false;" ..
esc(defaulttexturedir) .. "gift_btn_pressed.png]"
end
if PLATFORM ~= "Android" and PLATFORM ~= "iOS" then
retval = retval ..
@ -128,7 +136,7 @@ local function get_formspec()
"label[6.6,-0.3;" .. fgettext("Name") .. ":" .. "]" ..
"label[9.3,-0.3;" .. fgettext("Password") .. ":" .. "]" ..
"field[6.9,0.6;2.8,0.5;te_playername;;" ..
core.formspec_escape(core.settings:get("name")) .. "]" ..
esc(core.settings:get("name")) .. "]" ..
"pwdfield[9.6,0.6;2.8,0.5;te_passwd;]"
end
@ -255,6 +263,10 @@ local function main_button_handler(this, fields, name)
return true
end
if fields["upgrade"] then
core.upgrade("")
end
--[[if fields["world_configure"] ~= nil then
local selected = core.get_table_index("sp_worlds")
if selected ~= nil then

View File

@ -40,57 +40,56 @@ local function get_formspec(tabview, name, tabdata)
if PLATFORM == "Android" or PLATFORM == "iOS" then
search_panel =
"field[0.2,0.1;5.19,1;te_search;;" .. esc(tabdata.search_for) .. "]" ..
"image_button[4.89,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "search.png")
.. ";btn_mp_search;;true;false]" ..
"image_button[5.59,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "refresh.png")
.. ";btn_mp_refresh;;true;false]" ..
"style[btn_mp_search;content_offset=0]" ..
"image_button[4.89,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "search.png") ..
";btn_mp_search;;true;false]" ..
"image_button[5.59,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "refresh.png") ..
";btn_mp_refresh;;true;false]" ..
"image_button[6.29,-0.13;0.83,0.83;" .. esc(defaulttexturedir ..
(serverlistmgr.mobile_only and "online_mobile" or "online_pc") .. ".png")
.. ";btn_mp_mobile;;true;false]"
(serverlistmgr.mobile_only and "online_mobile" or "online_pc") .. ".png") ..
";btn_mp_mobile;;true;false]"
else
search_panel =
"field[0.2,0.1;5.8,1;te_search;;" .. core.formspec_escape(tabdata.search_for) .. "]" ..
"image_button[5.5,-0.13;0.83,0.83;" .. core.formspec_escape(defaulttexturedir .. "search.png")
.. ";btn_mp_search;;true;false]" ..
"image_button[6.26,-0.13;0.83,0.83;" .. core.formspec_escape(defaulttexturedir .. "refresh.png")
.. ";btn_mp_refresh;;true;false]"
"field[0.2,0.1;5.8,1;te_search;;" .. esc(tabdata.search_for) .. "]" ..
"style[btn_mp_search;content_offset=0]" ..
"image_button[5.5,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "search.png") ..
";btn_mp_search;;true;false]" ..
"image_button[6.26,-0.13;0.83,0.83;" .. esc(defaulttexturedir .. "refresh.png") ..
";btn_mp_refresh;;true;false]"
end
local retval =
-- Search
search_panel..
search_panel ..
-- Address / Port
"label[7.1,-0.3;" .. fgettext("Address") .. ":" .. "]" ..
"label[10.15,-0.3;" .. fgettext("Port") .. ":" .. "]" ..
"field[7.4,0.6;3.2,0.5;te_address;;" ..
"field[7.4,0.6;3.2,0.5;te_address;" .. fgettext("Address") .. ":" .. ";" ..
esc(core.settings:get("address")) .. "]" ..
"field[10.45,0.6;1.95,0.5;te_port;;" ..
"field[10.45,0.6;1.95,0.5;te_port;" .. fgettext("Port") .. ":" .. ";" ..
esc(core.settings:get("remote_port")) .. "]" ..
-- Name
"label[7.1,0.85;" .. fgettext("Name") .. ":" .. "]" ..
"label[10.15,0.85;" .. fgettext("Password") .. ":" .. "]" ..
"field[7.4,1.75;3.2,0.5;te_name;;" ..
"field[7.4,1.75;3.2,0.5;te_name;" .. fgettext("Name") .. ":" .. ";" ..
esc(core.settings:get("name")) .. "]" ..
-- Description Background
"box[7.1,2.1;4.8,2.65;#999999]" ..
"box[7.1,2.1;4.8,2.65;#33314B99]" ..
-- Connect
"image_button[8.8,4.88;3.3,0.9;" ..
esc(defaulttexturedir .. "blank.png")
.. ";btn_mp_connect;;true;false]" ..
"style[btn_mp_connect;fgimg=" .. esc(defaulttexturedir .. "btn_play.png") ..
";fgimg_hovered=" .. esc(defaulttexturedir .. "btn_play_hover.png") .. "]" ..
"image_button[8.8,4.88;3.3,0.9;;btn_mp_connect;;true;false]" ..
"tooltip[btn_mp_connect;".. fgettext("Connect") .. "]"
local pwd = password_save and esc(core.settings:get("password")) or password_tmp
local pwd = password_save and core.settings:get("password") or password_tmp
-- Password
retval = retval .. "pwdfield[10.45,1.8;1.95,0.39;te_pwd;;" .. pwd .. "]"
retval = retval .. "pwdfield[10.45,1.8;1.95,0.39;te_pwd;" ..
fgettext("Password") .. ":" .. ";" .. esc(pwd) .. "]"
if tabdata.selected and selected then
if gamedata.fav then
retval = retval .. "image_button[7.1,4.91;0.83,0.83;" .. esc(defaulttexturedir .. "trash.png")
.. ";btn_delete_favorite;;true;false]"
retval = retval .. "image_button[7.1,4.91;0.83,0.83;" ..
esc(defaulttexturedir .. "trash.png") .. ";btn_delete_favorite;;true;false]"
end
if selected.description then
retval = retval .. "textarea[7.5,2.2;4.8,3;;" ..
@ -98,12 +97,14 @@ local function get_formspec(tabview, name, tabdata)
end
end
--favourites
--favorites
retval = retval ..
"tableoptions[background=#27233F;border=false]" ..
"background9[-0.07,0.7;7.19,5.08;" ..
esc(defaulttexturedir) .. "worldlist_bg.png" .. ";false;40]" ..
"tableoptions[background=#0000;border=false]" ..
"tablecolumns[" ..
image_column(fgettext("Favorite")) .. ",align=center;" ..
image_column(fgettext("Lag")) .. ",padding=0.25;" ..
image_column(fgettext("Lag")) .. ",padding=0.5;" ..
"color,span=3;" ..
"text,align=right;" .. -- clients
"text,align=center,padding=0.25;" .. -- "/"
@ -111,7 +112,7 @@ local function get_formspec(tabview, name, tabdata)
image_column(fgettext("Server mode")) .. ",padding=0.5;" ..
"color,span=1;" ..
"text,padding=0.5]" ..
"table[-0.09,0.7;6.99,4.93;favorites;"
"table[-0.1,0.7;7,4.94;favorites;"
if menudata.search_result then
local favs = serverlistmgr.get_favorites()
@ -140,7 +141,7 @@ local function get_formspec(tabview, name, tabdata)
table.insert(serverlistmgr.servers, i, table.remove(serverlistmgr.servers, j))
end
end
if favs[i].address ~= serverlistmgr.servers[i].address then
if serverlistmgr.servers[i] and favs[i].address ~= serverlistmgr.servers[i].address then
table.insert(serverlistmgr.servers, i, favs[i])
end
end

View File

@ -338,7 +338,7 @@ end
return {
name = "settings",
caption = fgettext("Settings"),
caption = "", -- fgettext("Settings"),
cbf_formspec = formspec,
cbf_button_handler = handle_settings_buttons
}

View File

@ -0,0 +1,258 @@
--Minetest
--Copyright (C) 2020-2022 MultiCraft Development Team
--Copyright (C) 2013 sapier
--
--This program is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 3.0 of the License, or
--(at your option) any later version.
--
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License along
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------------
local labels = {
node_highlighting = {
fgettext("Node Outlining"),
fgettext("Node Highlighting"),
fgettext("None")
}
}
local dd_options = {
node_highlighting = {
table.concat(labels.node_highlighting, ","),
{"box", "halo", "none"}
}
}
local getSettingIndex = {
NodeHighlighting = function()
local style = core.settings:get("node_highlighting")
for idx, name in pairs(dd_options.node_highlighting[2]) do
if style == name then return idx end
end
return 1
end
}
local function formspec(tabview, name, tabdata)
local fps = tonumber(core.settings:get("fps_max"))
local range = tonumber(core.settings:get("viewing_range"))
local sensitivity = tonumber(core.settings:get("mouse_sensitivity")) * 2000
local touchtarget = core.settings:get_bool("touchtarget") or false
local sound = tonumber(core.settings:get("sound_volume")) ~= 0 and true or false
local tab_string =
"box[0,0;3.75,5.5;#999999]" ..
"checkbox[0.25,-0.05;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";"
.. dump(core.settings:get_bool("smooth_lighting")) .. "]" ..
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";"
.. dump(core.settings:get_bool("enable_particles")) .. "]" ..
"checkbox[0.25,1.1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";"
.. dump(core.settings:get_bool("enable_3d_clouds")) .. "]" ..
--[["checkbox[0.25,1.7;cb_opaque_water;" .. fgettext("Opaque Water") .. ";"
.. dump(core.settings:get_bool("opaque_water")) .. "]" ..
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
.. dump(core.settings:get_bool("connected_glass")) .. "]" ..]]
"checkbox[0.25,1.7;cb_fog;" .. fgettext("Fog") .. ";"
.. dump(core.settings:get_bool("enable_fog")) .. "]" ..
"checkbox[0.25,2.3;cb_inventory_items_animations;" .. fgettext("Inv. animations") .. ";"
.. dump(core.settings:get_bool("inventory_items_animations")) .. "]" ..
"checkbox[0.25,2.9;cb_fancy_leaves;" .. fgettext("Fancy Leaves") .. ";"
.. dump(sound) .. "]" ..
"checkbox[0.25,3.5;cb_touchtarget;" .. fgettext("Touchtarget") .. ";"
.. dump(touchtarget) .. "]" ..
"checkbox[0.25,4.1;cb_sound;" .. fgettext("Sound") .. ";"
.. dump(sound) .. "]" ..
"box[4,0;3.75,5.5;#999999]" ..
"label[4.25,0.15;" .. fgettext("Maximum FPS") .. ":]" ..
"dropdown[4.25,0.6;3.5;dd_fps_max;30,35,45,60;" ..
tonumber(fps <= 30 and 1 or fps == 35 and 2 or fps == 45 and 3 or 4) .. "]" ..
"label[4.25,1.5;" .. fgettext("Viewing range") .. ":]" ..
"dropdown[4.25,1.95;3.5;dd_viewing_range;30,40,60,80,100,125,150,175,200;" ..
tonumber(range <= 30 and 1 or range == 40 and 2 or range == 60 and 3 or
range == 80 and 4 or range == 100 and 5 or range == 125 and 6 or
range == 150 and 7 or range == 175 and 8 or 9) .. "]" ..
"label[4.25,2.85;" .. fgettext("Node highlighting") .. ":]" ..
"dropdown[4.25,3.3;3.5;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";"
.. getSettingIndex.NodeHighlighting() .. "]" ..
"label[4.25,4.2;" .. fgettext("Mouse sensitivity") .. ":]" ..
"scrollbar[4.25,4.65;3.22,0.5;horizontal;sb_sensitivity;" .. sensitivity .. "]" ..
-- "box[8,0;3.75,4.5;#999999]"
"box[8,0;3.75,5.5;#999999]"
local video_driver = core.settings:get("video_driver")
local shaders_enabled = video_driver == "opengl" or video_driver == "ogles2"
core.settings:set_bool("enable_shaders", shaders_enabled)
if shaders_enabled then
tab_string = tab_string ..
"label[8.25,0.15;" .. fgettext("Shaders") .. "]"
else
tab_string = tab_string ..
"label[8.25,0.15;" .. core.colorize("#888888",
fgettext("Shaders (unavailable)")) .. "]"
end
--[[tab_string = tab_string ..
"button[8,3.22;3.95,1;btn_change_keys;"
.. fgettext("Change Keys") .. "]"
tab_string = tab_string ..
"button[8,4.57;3.95,1;btn_advanced_settings;"
.. fgettext("All Settings") .. "]"]]
if shaders_enabled then
tab_string = tab_string ..
"checkbox[8.25,0.55;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
.. dump(core.settings:get_bool("tone_mapping")) .. "]" ..
"checkbox[8.25,1.15;cb_waving_water;" .. fgettext("Waving liquids") .. ";"
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
"checkbox[8.25,1.75;cb_waving_leaves;" .. fgettext("Waving leaves") .. ";"
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
"checkbox[8.25,2.35;cb_waving_plants;" .. fgettext("Waving plants") .. ";"
.. dump(core.settings:get_bool("enable_waving_plants")) .. "]"
else
tab_string = tab_string ..
"label[8.38,0.75;" .. core.colorize("#888888",
fgettext("Tone Mapping")) .. "]" ..
"label[8.38,1.35;" .. core.colorize("#888888",
fgettext("Waving Liquids")) .. "]" ..
"label[8.38,1.95;" .. core.colorize("#888888",
fgettext("Waving Leaves")) .. "]" ..
"label[8.38,2.55;" .. core.colorize("#888888",
fgettext("Waving Plants")) .. "]"
end
return tab_string
end
--------------------------------------------------------------------------------
local function handle_settings_buttons(this, fields, tabname, tabdata)
-- Note dropdowns have to be handled LAST!
local ddhandled = false
--[[if fields["btn_advanced_settings"] ~= nil then
local adv_settings_dlg = create_adv_settings_dlg()
adv_settings_dlg:set_parent(this)
this:hide()
adv_settings_dlg:show()
return true
end]]
if fields["cb_smooth_lighting"] then
core.settings:set("smooth_lighting", fields["cb_smooth_lighting"])
return true
end
if fields["cb_particles"] then
core.settings:set("enable_particles", fields["cb_particles"])
return true
end
if fields["cb_3d_clouds"] then
core.settings:set("enable_3d_clouds", fields["cb_3d_clouds"])
return true
end
if fields["cb_opaque_water"] then
core.settings:set("opaque_water", fields["cb_opaque_water"])
return true
end
--[[if fields["cb_connected_glass"] then
core.settings:set("connected_glass", fields["cb_connected_glass"])
return true
end]]
if fields["cb_fog"] then
core.settings:set("enable_fog", fields["cb_fog"])
return true
end
if fields["cb_inventory_items_animations"] then
core.settings:set("inventory_items_animations", fields["cb_inventory_items_animations"])
return true
end
if fields["cb_fancy_leaves"] then
core.settings:set("dd_leaves_style", fields["cb_fancy_leaves"] and "fancy" or "opaque")
ddhandled = true
end
if fields["cb_touchtarget"] then
core.settings:set("touchtarget", fields["cb_touchtarget"])
return true
end
if fields["cb_sound"] then
core.settings:set("sound_volume", (minetest.is_yes(fields["cb_sound"]) and "1.0") or "0.0")
return true
end
if fields["cb_shaders"] then
core.settings:set("enable_shaders", fields["cb_shaders"])
return true
end
if fields["cb_tonemapping"] then
core.settings:set("tone_mapping", fields["cb_tonemapping"])
return true
end
if fields["cb_waving_water"] then
core.settings:set("enable_waving_water", fields["cb_waving_water"])
return true
end
if fields["cb_waving_leaves"] then
core.settings:set("enable_waving_leaves", fields["cb_waving_leaves"])
end
if fields["cb_waving_plants"] then
core.settings:set("enable_waving_plants", fields["cb_waving_plants"])
return true
end
--[[if fields["btn_change_keys"] then
core.show_keys_menu()
return true
end]]
if fields["cb_touchscreen_target"] then
core.settings:set("touchtarget", fields["cb_touchscreen_target"])
ddhandled = true
end
for i = 1, #labels.node_highlighting do
if fields["dd_node_highlighting"] == labels.node_highlighting[i] then
core.settings:set("node_highlighting", dd_options.node_highlighting[2][i])
ddhandled = true
end
end
if fields["dd_fps_max"] then
core.settings:set("fps_max", fields["dd_fps_max"])
ddhandled = true
end
if fields["dd_viewing_range"] then
core.settings:set("viewing_range", fields["dd_viewing_range"])
ddhandled = true
end
if fields["sb_sensitivity"] then
-- reset old setting
core.settings:remove("touchscreen_threshold")
local event = core.explode_scrollbar_event(fields["sb_sensitivity"])
if event.type == "CHG" then
core.settings:set("mouse_sensitivity", event.value / 2000)
-- The formspec cannot be updated or the scrollbar movement will
-- break.
ddhandled = false
end
end
return ddhandled
end
return {
name = "settings",
caption = "", -- fgettext("Settings"),
cbf_formspec = formspec,
cbf_button_handler = handle_settings_buttons
}

View File

@ -46,6 +46,12 @@ end
--------------------------------------------------------------------------------
function mm_texture.reset()
mm_texture.gameid = nil
local have_bg = false
local have_overlay = mm_texture.set_generic("overlay")
if not have_overlay then
have_bg = mm_texture.set_generic("background")
end
mm_texture.clear("header")
mm_texture.clear("footer")
@ -54,7 +60,13 @@ function mm_texture.reset()
mm_texture.set_generic("footer")
mm_texture.set_generic("header")
mm_texture.set_dirt_bg()
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_texture.set_dirt_bg()
end
end
end
--------------------------------------------------------------------------------

View File

@ -516,7 +516,6 @@ void RenderingEngine::_draw_load_screen(const std::wstring &text,
guienv->addStaticText(text.c_str(), textrect, false, false);
guitext->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
clouds = false; // disable clouds at loading time
bool cloud_menu_background = clouds && g_settings->getBool("menu_clouds");
if (cloud_menu_background) {
g_menuclouds->step(dtime * 3);

View File

@ -220,7 +220,7 @@ void set_default_settings()
settings->setDefault("fall_bobbing_amount", "1.0");
settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "true");
settings->setDefault("menu_clouds", "false");
settings->setDefault("opaque_water", "false");
settings->setDefault("console_height", "0.6");
settings->setDefault("console_color", "(0,0,0)");
@ -490,7 +490,6 @@ void set_default_settings()
settings->setDefault("screen_dpi", "72");
settings->setDefault("display_density_factor", "1");
settings->setDefault("mainmenu_last_selected_world", "1");
settings->setDefault("device_is_tablet", "false");
// Altered settings for macOS

View File

@ -509,7 +509,7 @@ void GUIEngine::drawHeader(video::IVideoDriver *driver)
if (free_space > splashsize.Y) {
core::rect<s32> splashrect(0, 0, splashsize.X, splashsize.Y);
splashrect += v2s32((screensize.Width/2)-(splashsize.X/2),
((free_space/2)-splashsize.Y/2)+10);
((free_space/2)-splashsize.Y/2));
draw2DImageFilterScaled(driver, texture, splashrect,
core::rect<s32>(core::position2d<s32>(0,0),

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_base.h"
#include "lua_api/l_http.h"
#include "lua_api/l_mainmenu.h"
#include "lua_api/l_noise.h"
#include "lua_api/l_sound.h"
#include "lua_api/l_util.h"
#include "lua_api/l_settings.h"
@ -82,6 +83,7 @@ void MainMenuScripting::initializeModApi(lua_State *L, int top)
/******************************************************************************/
void MainMenuScripting::registerLuaClasses(lua_State *L, int top)
{
LuaSecureRandom::Register(L);
LuaSettings::Register(L);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 210 B

BIN
textures/base/pack/server_flags_damage.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 194 B

BIN
textures/base/pack/server_flags_favorite.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B