Skip to content
Permalink
Browse files

Reorganizing client and server tabs

  • Loading branch information
kilbith authored and Zeno- committed Jan 14, 2015
1 parent e19dab2 commit 227e4807b4d6e2f7d59bbe662df9122128952739
Showing with 94 additions and 50 deletions.
  1. +12 −11 builtin/mainmenu/tab_multiplayer.lua
  2. +82 −39 builtin/mainmenu/tab_settings.lua
@@ -20,26 +20,27 @@ local function get_formspec(tabview, name, tabdata)
local render_details = core.is_yes(core.setting_getbool("public_serverlist"))

local retval =
"label[0,4.25;" .. fgettext("Address/Port") .. "]" ..
"label[9,2.75;" .. fgettext("Name/Password") .. "]" ..
"field[0.25,5.25;5.5,0.5;te_address;;" ..
"label[7.75,-0.15;" .. fgettext("Address / Port :") .. "]" ..
"label[7.75,1.05;" .. fgettext("Name / Password :") .. "]" ..
"field[8,0.75;3.4,0.5;te_address;;" ..
core.formspec_escape(core.setting_get("address")) .. "]" ..
"field[5.75,5.25;2.25,0.5;te_port;;" ..
"field[11.25,0.75;1.3,0.5;te_port;;" ..
core.formspec_escape(core.setting_get("remote_port")) .. "]" ..
"checkbox[0,3.6;cb_public_serverlist;" .. fgettext("Public Serverlist") .. ";" ..
"checkbox[0,4.85;cb_public_serverlist;" .. fgettext("Public Serverlist") .. ";" ..
dump(core.setting_getbool("public_serverlist")) .. "]"

if not core.setting_getbool("public_serverlist") then
retval = retval ..
"button[6.45,3.95;2.25,0.5;btn_delete_favorite;" .. fgettext("Delete") .. "]"
"button[8,4.9;2,0.5;btn_delete_favorite;" .. fgettext("Delete") .. "]"
end

retval = retval ..
"button[9,4.95;2.5,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" ..
"field[9.3,3.75;2.5,0.5;te_name;;" ..
"button[10,4.9;2,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" ..
"field[8,1.95;2.95,0.5;te_name;;" ..
core.formspec_escape(core.setting_get("name")) .. "]" ..
"pwdfield[9.3,4.5;2.5,0.5;te_pwd;]" ..
"textarea[9.3,0;2.5,3.1;;"
"pwdfield[10.78,1.95;1.77,0.5;te_pwd;]" ..
"box[7.8,2.35;4.16,2.28;#999999]" ..
"textarea[8.15,2.4;4.25,2.6;;"

if tabdata.fav_selected ~= nil and
menudata.favorites[tabdata.fav_selected] ~= nil and
@@ -66,7 +67,7 @@ local function get_formspec(tabview, name, tabdata)
retval = retval .. "tablecolumns[text]"
end
retval = retval ..
"table[0,0;8.5,3.7;favourites;"
"table[-0.1,-0.1;7.75,5;favourites;"

if #menudata.favorites > 0 then
retval = retval .. render_favorite(menudata.favorites[1],render_details)
@@ -116,21 +116,50 @@ local function formspec(tabview, name, tabdata)
local current_video_driver_idx = 0
local current_video_driver = core.setting_get("video_driver")
for i=1, #video_drivers, 1 do

if i ~= 1 then
video_driver_string = video_driver_string .. ","
end
video_driver_string = video_driver_string .. video_drivers[i]

local video_driver = string.gsub(video_drivers[i], " ", "")
if current_video_driver:lower() == video_driver:lower() then
current_video_driver_idx = i
end
end



local filters = {
{"No Filter,Bilinear Filter,Trilinear Filter"},
{"", "bilinear_filter", "trilinear_filter"},
}

local mipmap = {
{"No Mipmap,Mipmap,Mipmap + Aniso. Filter"},
{"", "mip_map", "anisotropic_filter"},
}

local function getFilterSettingIndex()
if (core.setting_get(filters[2][3]) == "true") then
return 3
end
if (core.setting_get(filters[2][3]) == "false" and core.setting_get(filters[2][2]) == "true") then
return 2
end
return 1
end

local function getMipmapSettingIndex()
if (core.setting_get(mipmap[2][3]) == "true") then
return 3
end
if (core.setting_get(mipmap[2][3]) == "false" and core.setting_get(mipmap[2][2]) == "true") then
return 2
end
return 1
end

local tab_string =
"box[0,0;3.5,4;#999999]" ..
"box[0,0;3.5,3.9;#999999]" ..
"checkbox[0.25,0;cb_smooth_lighting;".. fgettext("Smooth Lighting")
.. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]"..
"checkbox[0.25,0.5;cb_particles;".. fgettext("Enable Particles") .. ";"
@@ -143,22 +172,23 @@ local function formspec(tabview, name, tabdata)
.. dump(core.setting_getbool("opaque_water")) .. "]"..
"checkbox[0.25,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
.. dump(core.setting_getbool("connected_glass")) .. "]"..
"dropdown[0.25,3.25;3.25;dd_video_driver;"
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
"checkbox[0.25,3.0;cb_node_highlighting;".. fgettext("Node Highlighting") .. ";"
.. dump(core.setting_getbool("enable_node_highlighting")) .. "]"..
"box[3.75,0;3.75,3.45;#999999]" ..
"label[3.85,0.1;".. fgettext("Texturing:") .. "]"..
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1][1] .. ";"
.. getFilterSettingIndex() .. "]" ..
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. mipmap[1][1] .. ";"
.. getMipmapSettingIndex() .. "]" ..
"label[3.85,2.15;".. fgettext("Rendering:") .. "]"..
"dropdown[3.85,2.6;3.85;dd_video_driver;"
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
"tooltip[dd_video_driver;" ..
fgettext("Restart minetest for driver change to take effect") .. "]" ..
"box[3.75,0;3.75,2.5;#999999]" ..
"checkbox[4,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
.. dump(core.setting_getbool("mip_map")) .. "]"..
"checkbox[4,0.5;cb_anisotrophic;".. fgettext("Anisotropic Filtering") .. ";"
.. dump(core.setting_getbool("anisotropic_filter")) .. "]"..
"checkbox[4,1.0;cb_bilinear;".. fgettext("Bi-Linear Filtering") .. ";"
.. dump(core.setting_getbool("bilinear_filter")) .. "]"..
"checkbox[4,1.5;cb_trilinear;".. fgettext("Tri-Linear Filtering") .. ";"
.. dump(core.setting_getbool("trilinear_filter")) .. "]"..
fgettext("Restart minetest for driver change to take effect") .. "]" ..
"box[7.75,0;4,4;#999999]" ..
"checkbox[8,0;cb_shaders;".. fgettext("Shaders") .. ";"
.. dump(core.setting_getbool("enable_shaders")) .. "]"

if PLATFORM ~= "Android" then
tab_string = tab_string ..
"button[8,4.75;3.75,0.5;btn_change_keys;".. fgettext("Change keys") .. "]"
@@ -167,7 +197,7 @@ local function formspec(tabview, name, tabdata)
"button[8,4.75;3.75,0.5;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. "]"
end
tab_string = tab_string ..
"box[0,4.25;3.5,1.25;#999999]" ..
"box[0,4.25;3.5,1.1;#999999]" ..
"label[0.25,4.25;" .. fgettext("GUI scale factor") .. "]" ..
"scrollbar[0.25,4.75;3,0.4;sb_gui_scaling;horizontal;" ..
gui_scale_to_scrollbar() .. "]" ..
@@ -177,15 +207,15 @@ local function formspec(tabview, name, tabdata)

if PLATFORM == "Android" then
tab_string = tab_string ..
"box[4.25,2.75;3.25,2.15;#999999]" ..
"checkbox[4.5,2.75;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
"box[3.75,3.55;3.75,1.8;#999999]" ..
"checkbox[3.9,3.45;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
.. dump(core.setting_getbool("touchtarget")) .. "]"
end

if core.setting_get("touchscreen_threshold") ~= nil then
tab_string = tab_string ..
"label[4.5,3.5;" .. fgettext("Touchthreshold (px)") .. "]" ..
"dropdown[4.5,4;3;dd_touchthreshold;0,10,20,30,40,50;" ..
"label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" ..
"dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" ..
((tonumber(core.setting_get("touchscreen_threshold"))/10)+1) .. "]"
end

@@ -233,22 +263,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
core.setting_set("opaque_water", fields["cb_opaque_water"])
return true
end
if fields["cb_mipmapping"] then
core.setting_set("mip_map", fields["cb_mipmapping"])
return true
end
if fields["cb_anisotrophic"] then
core.setting_set("anisotropic_filter", fields["cb_anisotrophic"])
return true
end
if fields["cb_bilinear"] then
core.setting_set("bilinear_filter", fields["cb_bilinear"])
return true
end
if fields["cb_trilinear"] then
core.setting_set("trilinear_filter", fields["cb_trilinear"])
return true
end
if fields["cb_shaders"] then
if (core.setting_get("video_driver") == "direct3d8" or core.setting_get("video_driver") == "direct3d9") then
core.setting_set("enable_shaders", "false")
@@ -262,6 +276,10 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
core.setting_set("connected_glass", fields["cb_connected_glass"])
return true
end
if fields["cb_node_highlighting"] then
core.setting_set("enable_node_highlighting", fields["cb_node_highlighting"])
return true
end
if fields["cb_particles"] then
core.setting_set("enable_particles", fields["cb_particles"])
return true
@@ -312,6 +330,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)

--Note dropdowns have to be handled LAST!
local ddhandled = false

if fields["dd_touchthreshold"] then
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
ddhandled = true
@@ -321,7 +340,31 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
core.setting_set("video_driver",string.lower(video_driver))
ddhandled = true
end

if fields["dd_filters"] == "No Filter" then
core.setting_set("bilinear_filter", "false")
core.setting_set("trilinear_filter", "false")
end
if fields["dd_filters"] == "Bilinear Filter" then
core.setting_set("bilinear_filter", "true")
core.setting_set("trilinear_filter", "false")
end
if fields["dd_filters"] == "Trilinear Filter" then
core.setting_set("bilinear_filter", "false")
core.setting_set("trilinear_filter", "true")
end
if fields["dd_mipmap"] == "No Mipmap" then
core.setting_set("mip_map", "false")
core.setting_set("anisotropic_filter", "false")
end
if fields["dd_mipmap"] == "Mipmap" then
core.setting_set("mip_map", "true")
core.setting_set("anisotropic_filter", "false")
end
if fields["dd_mipmap"] == "Mipmap + Aniso. Filter" then
core.setting_set("mip_map", "true")
core.setting_set("anisotropic_filter", "true")
end

This comment has been minimized.

Copy link
@HybridDog

HybridDog Jan 15, 2015

Contributor

l think you could use 4 elseifs here.

return ddhandled
end

0 comments on commit 227e480

Please sign in to comment.