Add Irrlicht device info to the mainmenu About tab (#13636)

This commit is contained in:
DS 2023-07-17 20:44:54 +02:00 committed by GitHub
parent 9b310a6e6f
commit f41e9e3e0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 3 deletions

@ -16,6 +16,10 @@ You can use `minetest --version` to find it.
```
<!-- For graphical and input-related issues. You can find these in the About tab in the mainmenu. -->
Active renderer:
Irrlicht device:
##### OS / Hardware
<!-- General information about your hardware and operating system -->
Operating system:

@ -172,10 +172,18 @@ return {
"scrollbar[15,0.1;0.4,6.9;vertical;scroll_credits;0]"
-- Render information
local active_renderer_info = fgettext("Active renderer:") .. " " ..
core.formspec_escape(core.get_active_renderer())
fs = fs .. "style[label_button2;border=false]" ..
"button[0.1,6;5.3,1;label_button2;" ..
fgettext("Active renderer:") .. "\n" ..
core.formspec_escape(core.get_active_renderer()) .. "]"
"button[0.1,6;5.3,0.5;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") .. "]"

@ -213,6 +213,8 @@ GUI
* technical name of active video driver, e.g. "opengl"
* `core.get_active_renderer()`:
* name of current renderer, e.g. "OpenGL 4.6"
* `core.get_active_irrlicht_device()`:
* name of current irrlicht device, e.g. "SDL"
* `core.get_window_info()`: Same as server-side `get_player_window_information` API.
```lua

@ -964,6 +964,23 @@ int ModApiMainMenu::l_get_active_renderer(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_active_irrlicht_device(lua_State *L)
{
const char *device_name = [] {
switch (RenderingEngine::get_raw_device()->getType()) {
case EIDT_WIN32: return "WIN32";
case EIDT_X11: return "X11";
case EIDT_OSX: return "OSX";
case EIDT_SDL: return "SDL";
case EIDT_ANDROID: return "ANDROID";
default: return "Unknown";
}
}();
lua_pushstring(L, device_name);
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_get_min_supp_proto(lua_State *L)
{
@ -1108,6 +1125,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_window_info);
API_FCT(get_active_driver);
API_FCT(get_active_renderer);
API_FCT(get_active_irrlicht_device);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);
API_FCT(open_url);

@ -110,6 +110,8 @@ private:
static int l_get_active_renderer(lua_State *L);
static int l_get_active_irrlicht_device(lua_State *L);
//filesystem
static int l_get_mainmenu_path(lua_State *L);