diff options
author | sfan5 <sfan5@live.de> | 2023-03-05 15:55:00 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-04-08 20:19:35 +0200 |
commit | c26e122485a7180edf434c0c1211713ff377d6d7 (patch) | |
tree | 425e362522dcaaf66c75fc79be9f743919ab65b3 /src/script/lua_api | |
parent | 67068cfaf43ef95e526401d9f788790516b9f8ed (diff) | |
download | minetest-c26e122485a7180edf434c0c1211713ff377d6d7.tar.xz |
Move video_driver default selection to runtime
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_mainmenu.cpp | 10 | ||||
-rw-r--r-- | src/script/lua_api/l_mainmenu.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index e19156e22..f55f0e52a 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -894,7 +894,7 @@ int ModApiMainMenu::l_download_file(lua_State *L) /******************************************************************************/ int ModApiMainMenu::l_get_video_drivers(lua_State *L) { - std::vector<irr::video::E_DRIVER_TYPE> drivers = RenderingEngine::getSupportedVideoDrivers(); + auto drivers = RenderingEngine::getSupportedVideoDrivers(); lua_newtable(L); for (u32 i = 0; i != drivers.size(); i++) { @@ -953,6 +953,13 @@ int ModApiMainMenu::l_get_window_info(lua_State *L) } /******************************************************************************/ +int ModApiMainMenu::l_get_active_driver(lua_State *L) +{ + auto drivertype = RenderingEngine::get_video_driver()->getDriverType(); + lua_pushstring(L, RenderingEngine::getVideoDriverInfo(drivertype).name.c_str()); + return 1; +} + int ModApiMainMenu::l_get_active_renderer(lua_State *L) { @@ -1102,6 +1109,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(gettext); API_FCT(get_video_drivers); API_FCT(get_window_info); + API_FCT(get_active_driver); API_FCT(get_active_renderer); API_FCT(get_min_supp_proto); API_FCT(get_max_supp_proto); diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index bb5c93cd5..538beaaa9 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -106,6 +106,8 @@ private: static int l_get_window_info(lua_State *L); + static int l_get_active_driver(lua_State *L); + static int l_get_active_renderer(lua_State *L); //filesystem |