mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Added a 'refreshrate' field to the table returned by love.window.getMode. The value may be 0 if the refresh rate of the monitor can't be determined. It might also be 59 instead of 60 on 59.94hz monitors on some operating systems.
This commit is contained in:
@@ -105,17 +105,16 @@ int w_setMode(lua_State *L)
|
||||
settings.minheight = luax_intflag(L, 3, settingName(Window::SETTING_MIN_HEIGHT), 1);
|
||||
settings.borderless = luax_boolflag(L, 3, settingName(Window::SETTING_BORDERLESS), false);
|
||||
settings.centered = luax_boolflag(L, 3, settingName(Window::SETTING_CENTERED), true);
|
||||
settings.display = luax_intflag(L, 3, settingName(Window::SETTING_DISPLAY), 1);
|
||||
settings.display = luax_intflag(L, 3, settingName(Window::SETTING_DISPLAY), 1) - 1;
|
||||
settings.highdpi = luax_boolflag(L, 3, settingName(Window::SETTING_HIGHDPI), false);
|
||||
settings.sRGB = luax_boolflag(L, 3, settingName(Window::SETTING_SRGB), false);
|
||||
|
||||
// We don't explicitly set the refresh rate, it's "read-only".
|
||||
|
||||
// For backward-compatibility. TODO: remove!
|
||||
int fsaa = luax_intflag(L, 3, settingName(Window::SETTING_FSAA), 0);
|
||||
if (fsaa > settings.msaa) settings.msaa = fsaa;
|
||||
|
||||
// Display index is 1-based in Lua and 0-based internally.
|
||||
settings.display--;
|
||||
|
||||
luax_catchexcept(L,
|
||||
[&](){ luax_pushboolean(L, instance()->setWindow(w, h, &settings)); }
|
||||
);
|
||||
@@ -176,6 +175,9 @@ int w_getMode(lua_State *L)
|
||||
luax_pushboolean(L, settings.sRGB);
|
||||
lua_setfield(L, -2, settingName(Window::SETTING_SRGB));
|
||||
|
||||
lua_pushnumber(L, settings.refreshrate);
|
||||
lua_setfield(L, -2, settingName(Window::SETTING_REFRESHRATE));
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user