mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 22:22:23 +01:00
Show warning in the settings menu when shaders are disabled (#15272)
This commit is contained in:
parent
ecf8488406
commit
7435ea0d4e
@ -19,6 +19,8 @@
|
||||
local component_funcs = dofile(core.get_mainmenu_path() .. DIR_DELIM ..
|
||||
"settings" .. DIR_DELIM .. "components.lua")
|
||||
|
||||
local shader_warning_component = dofile(core.get_mainmenu_path() .. DIR_DELIM ..
|
||||
"settings" .. DIR_DELIM .. "shader_warning_component.lua")
|
||||
local shadows_component = dofile(core.get_mainmenu_path() .. DIR_DELIM ..
|
||||
"settings" .. DIR_DELIM .. "shadows_component.lua")
|
||||
|
||||
@ -152,7 +154,12 @@ local function load()
|
||||
|
||||
table.insert(page_by_id.controls_keyboard_and_mouse.content, 1, change_keys)
|
||||
do
|
||||
local content = page_by_id.graphics_and_audio_effects.content
|
||||
local content = page_by_id.graphics_and_audio_graphics.content
|
||||
table.insert(content, 1, shader_warning_component)
|
||||
|
||||
content = page_by_id.graphics_and_audio_effects.content
|
||||
table.insert(content, 1, shader_warning_component)
|
||||
|
||||
local idx = table.indexof(content, "enable_dynamic_shadows")
|
||||
table.insert(content, idx, shadows_component)
|
||||
|
||||
@ -706,7 +713,7 @@ local function buttonhandler(this, fields)
|
||||
|
||||
local function after_setting_change(comp)
|
||||
write_settings_early()
|
||||
if comp.setting.name == "touch_controls" then
|
||||
if comp.setting and comp.setting.name == "touch_controls" then
|
||||
-- Changing the "touch_controls" setting may result in a different
|
||||
-- page list.
|
||||
regenerate_page_list(dialogdata)
|
||||
|
26
builtin/mainmenu/settings/shader_warning_component.lua
Normal file
26
builtin/mainmenu/settings/shader_warning_component.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- Minetest
|
||||
-- SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
return {
|
||||
query_text = "Shaders",
|
||||
requires = {
|
||||
shaders_support = true,
|
||||
shaders = false,
|
||||
},
|
||||
full_width = true,
|
||||
get_formspec = function(self, avail_w)
|
||||
local fs = {
|
||||
"box[0,0;", avail_w, ",1.2;", mt_color_orange, "]",
|
||||
"label[0.2,0.4;", fgettext("Shaders are disabled."), "]",
|
||||
"label[0.2,0.8;", fgettext("This is not a recommended configuration."), "]",
|
||||
"button[", avail_w - 2.2, ",0.2;2,0.8;fix_shader_warning;", fgettext("Enable"), "]",
|
||||
}
|
||||
return table.concat(fs, ""), 1.2
|
||||
end,
|
||||
on_submit = function(self, fields)
|
||||
if fields.fix_shader_warning then
|
||||
core.settings:remove("enable_shaders") -- default value is true
|
||||
return true
|
||||
end
|
||||
end,
|
||||
}
|
Loading…
Reference in New Issue
Block a user