Condense renderer information into a single string

This commit is contained in:
sfan5 2024-12-14 17:25:52 +01:00
parent 9f52f84f2b
commit 0bfd9bc09e
2 changed files with 25 additions and 19 deletions

@ -34,13 +34,6 @@ body:
render: "true"
validations:
required: true
- type: input
attributes:
label: Irrlicht device
description:
placeholder: "Example: X11"
validations:
required: false
- type: input
attributes:
label: Operating system and version
@ -69,7 +62,7 @@ body:
attributes:
label: Active renderer
description: You can find this in the "About" tab in the main menu.
placeholder: "Example: OpenGL 4.6.0"
placeholder: "Example: ES 3.2 / ogles2 / X11"
validations:
required: false
- type: textarea

@ -32,6 +32,27 @@ local function get_credits()
return json
end
local function get_renderer_info()
local ret = {}
-- OpenGL version, stripped to just the important part
local s1 = core.get_active_renderer()
if s1:sub(1, 7) == "OpenGL " then
s1 = s1:sub(8)
end
local m = s1:match("^[%d.]+")
if not m then
m = s1:match("^ES [%d.]+")
end
ret[#ret+1] = m or s1
-- video driver
ret[#ret+1] = core.get_active_driver():lower()
-- irrlicht device
ret[#ret+1] = core.get_active_irrlicht_device():upper()
return table.concat(ret, " / ")
end
return {
name = "about",
caption = fgettext("About"),
@ -81,20 +102,12 @@ return {
"button_url[1.5,4.1;2.5,0.8;homepage;luanti.org;https://www.luanti.org/]" ..
"hypertext[5.5,0.25;9.75,6.6;credits;" .. core.formspec_escape(hypertext) .. "]"
-- Render information
local active_renderer_info = fgettext("Active renderer:") .. " " ..
core.formspec_escape(core.get_active_renderer())
local active_renderer_info = fgettext("Active renderer:") .. "\n" ..
core.formspec_escape(get_renderer_info())
fs = fs .. "style[label_button2;border=false]" ..
"button[0.1,6;5.3,0.5;label_button2;" .. active_renderer_info .. "]"..
"button[0.1,6;5.3,1;label_button2;" .. active_renderer_info .. "]"..
"tooltip[label_button2;" .. active_renderer_info .. "]"
-- Irrlicht device information
local irrlicht_device_info = fgettext("Irrlicht device:") .. " " ..
core.formspec_escape(core.get_active_irrlicht_device())
fs = fs .. "style[label_button3;border=false]" ..
"button[0.1,6.5;5.3,0.5;label_button3;" .. irrlicht_device_info .. "]"..
"tooltip[label_button3;" .. irrlicht_device_info .. "]"
if PLATFORM == "Android" then
fs = fs .. "button[0.5,5.1;4.5,0.8;share_debug;" .. fgettext("Share debug log") .. "]"
else