1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Add Lua function get_video_modes() for main menu

Also updates and uses porting::getSupportedVideoModes()
This commit is contained in:
Craig Robbins 2015-03-28 11:05:39 +10:00
parent 3ef0b4e637
commit 2430b2e998
4 changed files with 34 additions and 2 deletions

View file

@ -570,16 +570,20 @@ void setXorgClassHint(const video::SExposedVideoData &video_data,
}
#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++) {
@ -588,6 +592,8 @@ std::vector<core::vector3d<u32> > getVideoModes()
mlist.push_back(core::vector3d<u32>(mode_res.Width, mode_res.Height, mode_depth));
}
nulldevice->drop();
return mlist;
}