Skip to content

Commit 227e480

Browse files
kilbithZeno-
authored andcommitted
Reorganizing client and server tabs
1 parent e19dab2 commit 227e480

File tree

2 files changed

+94
-50
lines changed

2 files changed

+94
-50
lines changed

builtin/mainmenu/tab_multiplayer.lua

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,27 @@ local function get_formspec(tabview, name, tabdata)
2020
local render_details = core.is_yes(core.setting_getbool("public_serverlist"))
2121

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

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

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

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

7172
if #menudata.favorites > 0 then
7273
retval = retval .. render_favorite(menudata.favorites[1],render_details)

builtin/mainmenu/tab_settings.lua

Lines changed: 82 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,50 @@ local function formspec(tabview, name, tabdata)
116116
local current_video_driver_idx = 0
117117
local current_video_driver = core.setting_get("video_driver")
118118
for i=1, #video_drivers, 1 do
119-
119+
120120
if i ~= 1 then
121121
video_driver_string = video_driver_string .. ","
122122
end
123123
video_driver_string = video_driver_string .. video_drivers[i]
124-
124+
125125
local video_driver = string.gsub(video_drivers[i], " ", "")
126126
if current_video_driver:lower() == video_driver:lower() then
127127
current_video_driver_idx = i
128128
end
129129
end
130-
131-
130+
131+
local filters = {
132+
{"No Filter,Bilinear Filter,Trilinear Filter"},
133+
{"", "bilinear_filter", "trilinear_filter"},
134+
}
135+
136+
local mipmap = {
137+
{"No Mipmap,Mipmap,Mipmap + Aniso. Filter"},
138+
{"", "mip_map", "anisotropic_filter"},
139+
}
140+
141+
local function getFilterSettingIndex()
142+
if (core.setting_get(filters[2][3]) == "true") then
143+
return 3
144+
end
145+
if (core.setting_get(filters[2][3]) == "false" and core.setting_get(filters[2][2]) == "true") then
146+
return 2
147+
end
148+
return 1
149+
end
150+
151+
local function getMipmapSettingIndex()
152+
if (core.setting_get(mipmap[2][3]) == "true") then
153+
return 3
154+
end
155+
if (core.setting_get(mipmap[2][3]) == "false" and core.setting_get(mipmap[2][2]) == "true") then
156+
return 2
157+
end
158+
return 1
159+
end
160+
132161
local tab_string =
133-
"box[0,0;3.5,4;#999999]" ..
162+
"box[0,0;3.5,3.9;#999999]" ..
134163
"checkbox[0.25,0;cb_smooth_lighting;".. fgettext("Smooth Lighting")
135164
.. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]"..
136165
"checkbox[0.25,0.5;cb_particles;".. fgettext("Enable Particles") .. ";"
@@ -143,22 +172,23 @@ local function formspec(tabview, name, tabdata)
143172
.. dump(core.setting_getbool("opaque_water")) .. "]"..
144173
"checkbox[0.25,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
145174
.. dump(core.setting_getbool("connected_glass")) .. "]"..
146-
"dropdown[0.25,3.25;3.25;dd_video_driver;"
147-
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
175+
"checkbox[0.25,3.0;cb_node_highlighting;".. fgettext("Node Highlighting") .. ";"
176+
.. dump(core.setting_getbool("enable_node_highlighting")) .. "]"..
177+
"box[3.75,0;3.75,3.45;#999999]" ..
178+
"label[3.85,0.1;".. fgettext("Texturing:") .. "]"..
179+
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1][1] .. ";"
180+
.. getFilterSettingIndex() .. "]" ..
181+
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. mipmap[1][1] .. ";"
182+
.. getMipmapSettingIndex() .. "]" ..
183+
"label[3.85,2.15;".. fgettext("Rendering:") .. "]"..
184+
"dropdown[3.85,2.6;3.85;dd_video_driver;"
185+
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
148186
"tooltip[dd_video_driver;" ..
149-
fgettext("Restart minetest for driver change to take effect") .. "]" ..
150-
"box[3.75,0;3.75,2.5;#999999]" ..
151-
"checkbox[4,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
152-
.. dump(core.setting_getbool("mip_map")) .. "]"..
153-
"checkbox[4,0.5;cb_anisotrophic;".. fgettext("Anisotropic Filtering") .. ";"
154-
.. dump(core.setting_getbool("anisotropic_filter")) .. "]"..
155-
"checkbox[4,1.0;cb_bilinear;".. fgettext("Bi-Linear Filtering") .. ";"
156-
.. dump(core.setting_getbool("bilinear_filter")) .. "]"..
157-
"checkbox[4,1.5;cb_trilinear;".. fgettext("Tri-Linear Filtering") .. ";"
158-
.. dump(core.setting_getbool("trilinear_filter")) .. "]"..
187+
fgettext("Restart minetest for driver change to take effect") .. "]" ..
159188
"box[7.75,0;4,4;#999999]" ..
160189
"checkbox[8,0;cb_shaders;".. fgettext("Shaders") .. ";"
161190
.. dump(core.setting_getbool("enable_shaders")) .. "]"
191+
162192
if PLATFORM ~= "Android" then
163193
tab_string = tab_string ..
164194
"button[8,4.75;3.75,0.5;btn_change_keys;".. fgettext("Change keys") .. "]"
@@ -167,7 +197,7 @@ local function formspec(tabview, name, tabdata)
167197
"button[8,4.75;3.75,0.5;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. "]"
168198
end
169199
tab_string = tab_string ..
170-
"box[0,4.25;3.5,1.25;#999999]" ..
200+
"box[0,4.25;3.5,1.1;#999999]" ..
171201
"label[0.25,4.25;" .. fgettext("GUI scale factor") .. "]" ..
172202
"scrollbar[0.25,4.75;3,0.4;sb_gui_scaling;horizontal;" ..
173203
gui_scale_to_scrollbar() .. "]" ..
@@ -177,15 +207,15 @@ local function formspec(tabview, name, tabdata)
177207

178208
if PLATFORM == "Android" then
179209
tab_string = tab_string ..
180-
"box[4.25,2.75;3.25,2.15;#999999]" ..
181-
"checkbox[4.5,2.75;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
210+
"box[3.75,3.55;3.75,1.8;#999999]" ..
211+
"checkbox[3.9,3.45;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
182212
.. dump(core.setting_getbool("touchtarget")) .. "]"
183213
end
184214

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

@@ -233,22 +263,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
233263
core.setting_set("opaque_water", fields["cb_opaque_water"])
234264
return true
235265
end
236-
if fields["cb_mipmapping"] then
237-
core.setting_set("mip_map", fields["cb_mipmapping"])
238-
return true
239-
end
240-
if fields["cb_anisotrophic"] then
241-
core.setting_set("anisotropic_filter", fields["cb_anisotrophic"])
242-
return true
243-
end
244-
if fields["cb_bilinear"] then
245-
core.setting_set("bilinear_filter", fields["cb_bilinear"])
246-
return true
247-
end
248-
if fields["cb_trilinear"] then
249-
core.setting_set("trilinear_filter", fields["cb_trilinear"])
250-
return true
251-
end
252266
if fields["cb_shaders"] then
253267
if (core.setting_get("video_driver") == "direct3d8" or core.setting_get("video_driver") == "direct3d9") then
254268
core.setting_set("enable_shaders", "false")
@@ -262,6 +276,10 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
262276
core.setting_set("connected_glass", fields["cb_connected_glass"])
263277
return true
264278
end
279+
if fields["cb_node_highlighting"] then
280+
core.setting_set("enable_node_highlighting", fields["cb_node_highlighting"])
281+
return true
282+
end
265283
if fields["cb_particles"] then
266284
core.setting_set("enable_particles", fields["cb_particles"])
267285
return true
@@ -312,6 +330,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
312330

313331
--Note dropdowns have to be handled LAST!
314332
local ddhandled = false
333+
315334
if fields["dd_touchthreshold"] then
316335
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
317336
ddhandled = true
@@ -321,7 +340,31 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
321340
core.setting_set("video_driver",string.lower(video_driver))
322341
ddhandled = true
323342
end
324-
343+
if fields["dd_filters"] == "No Filter" then
344+
core.setting_set("bilinear_filter", "false")
345+
core.setting_set("trilinear_filter", "false")
346+
end
347+
if fields["dd_filters"] == "Bilinear Filter" then
348+
core.setting_set("bilinear_filter", "true")
349+
core.setting_set("trilinear_filter", "false")
350+
end
351+
if fields["dd_filters"] == "Trilinear Filter" then
352+
core.setting_set("bilinear_filter", "false")
353+
core.setting_set("trilinear_filter", "true")
354+
end
355+
if fields["dd_mipmap"] == "No Mipmap" then
356+
core.setting_set("mip_map", "false")
357+
core.setting_set("anisotropic_filter", "false")
358+
end
359+
if fields["dd_mipmap"] == "Mipmap" then
360+
core.setting_set("mip_map", "true")
361+
core.setting_set("anisotropic_filter", "false")
362+
end
363+
if fields["dd_mipmap"] == "Mipmap + Aniso. Filter" then
364+
core.setting_set("mip_map", "true")
365+
core.setting_set("anisotropic_filter", "true")
366+
end
367+
325368
return ddhandled
326369
end
327370

0 commit comments

Comments
 (0)