summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Schreiber <mark7@alumni.cmu.edu>2015-06-28 01:25:38 -0700
committerest31 <MTest31@outlook.com>2015-07-18 08:40:57 +0200
commit74d8fdbd95e1e26d51b48bcf9585ab2890633d8b (patch)
treefe33f8ad8d6df130ae0d9cbf8985d73fe9ba96db
parentc5c609ce3d0ff7b959adc72c26486c14b2219046 (diff)
downloadminetest-74d8fdbd95e1e26d51b48bcf9585ab2890633d8b.tar.gz
minetest-74d8fdbd95e1e26d51b48bcf9585ab2890633d8b.tar.bz2
minetest-74d8fdbd95e1e26d51b48bcf9585ab2890633d8b.zip
Add antialiasing UI setting
The Irrlicht engine supports antialiasing, and Minetest already supports saving an antialiasing setting in its configuration file. However, Minetest lacked UI elements to set this setting, and previously the only way to enable the feature was by hand-editing the configuration file. Add a drop-down menu that can enable antialiasing.
-rw-r--r--builtin/mainmenu/tab_settings.lua43
1 files changed, 41 insertions, 2 deletions
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index 169f60a67..58ef4c540 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -60,6 +60,19 @@ local function getLeavesStyleSettingIndex()
return 1
end
+local dd_antialiasing_labels = {
+ fgettext("None"),
+ fgettext("2x"),
+ fgettext("4x"),
+ fgettext("8x"),
+}
+
+local antialiasing = {
+ {dd_antialiasing_labels[1]..","..dd_antialiasing_labels[2]..","..
+ dd_antialiasing_labels[3]..","..dd_antialiasing_labels[4]},
+ {"0", "2", "4", "8"}
+}
+
local function getFilterSettingIndex()
if (core.setting_get(filters[2][3]) == "true") then
return 3
@@ -80,6 +93,26 @@ local function getMipmapSettingIndex()
return 1
end
+local function getAntialiasingSettingIndex()
+ local antialiasing_setting = core.setting_get("fsaa")
+ for i=1, #(antialiasing[2]) do
+ if antialiasing_setting == antialiasing[2][i] then
+ return i
+ end
+ end
+ return 1
+end
+
+local function antialiasing_fname_to_name(fname)
+ for i=1, #(dd_antialiasing_labels) do
+ if fname == dd_antialiasing_labels[i] then
+ return antialiasing[2][i]
+ end
+ end
+
+ return "0"
+end
+
local function video_driver_fname_to_name(selected_driver)
local video_drivers = core.get_video_drivers()
@@ -214,13 +247,17 @@ local function formspec(tabview, name, tabdata)
"dropdown[0.25,3.2;3.3;dd_leaves_style;" .. leaves_style[1][1] .. ";"
.. getLeavesStyleSettingIndex() .. "]" ..
"box[3.75,0;3.75,3.45;#999999]" ..
+ "box[3.75,0;3.75,4.7;#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;"
+ "label[3.85,2.15;".. fgettext("Antialiasing:") .. "]"..
+ "dropdown[3.85,2.6;3.85;dd_antialiasing;" .. antialiasing[1][1] .. ";"
+ .. getAntialiasingSettingIndex() .. "]" ..
+ "label[3.85,3.4;".. fgettext("Rendering:") .. "]"..
+ "dropdown[3.85,3.85;3.85;dd_video_driver;"
.. driver_formspec_string .. ";" .. driver_current_idx .. "]" ..
"tooltip[dd_video_driver;" ..
fgettext("Restart minetest for driver change to take effect") .. "]" ..
@@ -421,6 +458,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
core.setting_set("anisotropic_filter", "true")
ddhandled = true
end
+ core.setting_set("fsaa",
+ antialiasing_fname_to_name(fields["dd_antialiasing"]))
return ddhandled
end