}
#ifndef SERVER
+
v2u32 getWindowSize()
{
return device->getVideoDriver()->getScreenSize();
}
-std::vector<core::vector3d<u32> > getVideoModes()
+std::vector<core::vector3d<u32> > getSupportedVideoModes()
{
+ IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
+ sanity_check(nulldevice != NULL);
+
std::vector<core::vector3d<u32> > mlist;
- video::IVideoModeList *modelist = device->getVideoModeList();
+ video::IVideoModeList *modelist = nulldevice->getVideoModeList();
u32 num_modes = modelist->getVideoModeCount();
for (u32 i = 0; i != num_modes; i++) {
mlist.push_back(core::vector3d<u32>(mode_res.Width, mode_res.Height, mode_depth));
}
+ nulldevice->drop();
+
return mlist;
}
v2u32 getDisplaySize();
v2u32 getWindowSize();
+std::vector<core::vector3d<u32> > getSupportedVideoModes();
std::vector<irr::video::E_DRIVER_TYPE> getSupportedVideoDrivers();
const char *getVideoDriverName(irr::video::E_DRIVER_TYPE type);
const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type);
return 1;
}
+/******************************************************************************/
+int ModApiMainMenu::l_get_video_modes(lua_State *L)
+{
+ std::vector<core::vector3d<u32> > videomodes
+ = porting::getSupportedVideoModes();
+
+ lua_newtable(L);
+ for (u32 i = 0; i != videomodes.size(); i++) {
+ lua_newtable(L);
+ lua_pushnumber(L, videomodes[i].X);
+ lua_setfield(L, -2, "w");
+ lua_pushnumber(L, videomodes[i].Y);
+ lua_setfield(L, -2, "h");
+ lua_pushnumber(L, videomodes[i].Z);
+ lua_setfield(L, -2, "depth");
+
+ lua_rawseti(L, -2, i + 1);
+ }
+
+ return 1;
+}
+
/******************************************************************************/
int ModApiMainMenu::l_gettext(lua_State *L)
{
API_FCT(sound_stop);
API_FCT(gettext);
API_FCT(get_video_drivers);
+ API_FCT(get_video_modes);
API_FCT(get_screen_info);
API_FCT(get_min_supp_proto);
API_FCT(get_max_supp_proto);