aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 3ed2ba0e0..7c86525f6 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -33,10 +33,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverlist.h"
#include "mapgen.h"
#include "settings.h"
-#include "EDriverTypes.h"
#include <IFileArchive.h>
#include <IFileSystem.h>
+#include "client/renderingengine.h"
/******************************************************************************/
@@ -628,8 +628,7 @@ int ModApiMainMenu::l_show_keys_menu(lua_State *L)
GUIEngine* engine = getGuiEngine(L);
sanity_check(engine != NULL);
- GUIKeyChangeMenu *kmenu
- = new GUIKeyChangeMenu( engine->m_device->getGUIEnvironment(),
+ GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(RenderingEngine::get_gui_env(),
engine->m_parent,
-1,
engine->m_menumanager);
@@ -832,9 +831,6 @@ int ModApiMainMenu::l_copy_dir(lua_State *L)
/******************************************************************************/
int ModApiMainMenu::l_extract_zip(lua_State *L)
{
- GUIEngine* engine = getGuiEngine(L);
- sanity_check(engine);
-
const char *zipfile = luaL_checkstring(L, 1);
const char *destination = luaL_checkstring(L, 2);
@@ -843,7 +839,7 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)
if (ModApiMainMenu::isMinetestPath(absolute_destination)) {
fs::CreateAllDirs(absolute_destination);
- io::IFileSystem* fs = engine->m_device->getFileSystem();
+ io::IFileSystem *fs = RenderingEngine::get_filesystem();
if (!fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP)) {
lua_pushboolean(L,false);
@@ -960,7 +956,7 @@ int ModApiMainMenu::l_show_path_select_dialog(lua_State *L)
bool is_file_select = lua_toboolean(L, 3);
GUIFileSelectMenu* fileOpenMenu =
- new GUIFileSelectMenu(engine->m_device->getGUIEnvironment(),
+ new GUIFileSelectMenu(RenderingEngine::get_gui_env(),
engine->m_parent,
-1,
engine->m_menumanager,
@@ -997,13 +993,12 @@ 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
- = porting::getSupportedVideoDrivers();
+ std::vector<irr::video::E_DRIVER_TYPE> drivers = RenderingEngine::getSupportedVideoDrivers();
lua_newtable(L);
for (u32 i = 0; i != drivers.size(); i++) {
- const char *name = porting::getVideoDriverName(drivers[i]);
- const char *fname = porting::getVideoDriverFriendlyName(drivers[i]);
+ const char *name = RenderingEngine::getVideoDriverName(drivers[i]);
+ const char *fname = RenderingEngine::getVideoDriverFriendlyName(drivers[i]);
lua_newtable(L);
lua_pushstring(L, name);
@@ -1021,7 +1016,7 @@ int ModApiMainMenu::l_get_video_drivers(lua_State *L)
int ModApiMainMenu::l_get_video_modes(lua_State *L)
{
std::vector<core::vector3d<u32> > videomodes
- = porting::getSupportedVideoModes();
+ = RenderingEngine::getSupportedVideoModes();
lua_newtable(L);
for (u32 i = 0; i != videomodes.size(); i++) {
@@ -1054,23 +1049,24 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
lua_newtable(L);
int top = lua_gettop(L);
lua_pushstring(L,"density");
- lua_pushnumber(L,porting::getDisplayDensity());
+ lua_pushnumber(L,RenderingEngine::getDisplayDensity());
lua_settable(L, top);
lua_pushstring(L,"display_width");
- lua_pushnumber(L,porting::getDisplaySize().X);
+ lua_pushnumber(L,RenderingEngine::getDisplaySize().X);
lua_settable(L, top);
lua_pushstring(L,"display_height");
- lua_pushnumber(L,porting::getDisplaySize().Y);
+ lua_pushnumber(L,RenderingEngine::getDisplaySize().Y);
lua_settable(L, top);
+ const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize();
lua_pushstring(L,"window_width");
- lua_pushnumber(L,porting::getWindowSize().X);
+ lua_pushnumber(L, window_size.X);
lua_settable(L, top);
lua_pushstring(L,"window_height");
- lua_pushnumber(L,porting::getWindowSize().Y);
+ lua_pushnumber(L, window_size.Y);
lua_settable(L, top);
return 1;
}