mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Add Lua function get_video_modes() for main menu
Also updates and uses porting::getSupportedVideoModes()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user