Add video driver selection to settings menu (based uppon idea from webdesigner97)

This commit is contained in:
sapier 2014-07-16 14:04:50 +02:00 committed by Nils Dagsson Moskopp
parent adeb452c4a
commit bc4f8c8979
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 27 additions and 1 deletions

View File

@ -110,6 +110,24 @@ local function scrollbar_to_gui_scale(value)
end end
local function formspec(tabview, name, tabdata) local function formspec(tabview, name, tabdata)
local video_drivers = core.get_video_drivers()
local video_driver_string = ""
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]
if current_video_driver:lower() == video_drivers[i]:lower() then
current_video_driver_idx = i
end
end
local tab_string = local tab_string =
"vertlabel[0,-0.25;" .. fgettext("SETTINGS") .. "]" .. "vertlabel[0,-0.25;" .. fgettext("SETTINGS") .. "]" ..
"box[0.75,0;3.25,4;#999999]" .. "box[0.75,0;3.25,4;#999999]" ..
@ -125,6 +143,10 @@ local function formspec(tabview, name, tabdata)
.. dump(core.setting_getbool("preload_item_visuals")) .. "]".. .. dump(core.setting_getbool("preload_item_visuals")) .. "]"..
"checkbox[1,2.5;cb_particles;".. fgettext("Enable Particles") .. ";" "checkbox[1,2.5;cb_particles;".. fgettext("Enable Particles") .. ";"
.. dump(core.setting_getbool("enable_particles")) .. "]".. .. dump(core.setting_getbool("enable_particles")) .. "]"..
"dropdown[1,3.25;3;dd_video_driver;"
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
"tooltip[dd_video_driver;" ..
fgettext("Restart minetest for driver change to take effect") .. "]" ..
"box[4.25,0;3.25,2.5;#999999]" .. "box[4.25,0;3.25,2.5;#999999]" ..
"checkbox[4.5,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";" "checkbox[4.5,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
.. dump(core.setting_getbool("mip_map")) .. "]".. .. dump(core.setting_getbool("mip_map")) .. "]"..
@ -284,16 +306,20 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
return true return true
end end
if fields["btn_reset_singleplayer"] then if fields["btn_reset_singleplayer"] then
print("sp reset")
showconfirm_reset(this) showconfirm_reset(this)
return true return true
end end
--Note dropdowns have to be handled LAST! --Note dropdowns have to be handled LAST!
local ddhandled = false local ddhandled = false
if fields["dd_touchthreshold"] then if fields["dd_touchthreshold"] then
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"]) core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
ddhandled = true ddhandled = true
end end
if fields["dd_video_driver"] then
core.setting_set("video_driver",fields["dd_video_driver"])
ddhandled = true
end
return ddhandled return ddhandled
end end