diff --git a/apps/openmw/mwlua/uibindings.cpp b/apps/openmw/mwlua/uibindings.cpp index b384994654..4c26c904f3 100644 --- a/apps/openmw/mwlua/uibindings.cpp +++ b/apps/openmw/mwlua/uibindings.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "context.hpp" #include "actions.hpp" #include "luamanagerimp.hpp" @@ -296,6 +298,14 @@ namespace MWLua return luaManager->uiResourceManager()->registerTexture(data); }; + api["screenSize"] = []() + { + return osg::Vec2f( + Settings::Manager::getInt("resolution x", "Video"), + Settings::Manager::getInt("resolution y", "Video") + ); + }; + return LuaUtil::makeReadOnly(api); } } diff --git a/files/lua_api/openmw/ui.lua b/files/lua_api/openmw/ui.lua index 6461588a69..57be0da501 100644 --- a/files/lua_api/openmw/ui.lua +++ b/files/lua_api/openmw/ui.lua @@ -38,6 +38,11 @@ -- @function [parent=#ui] showMessage -- @param #string msg +--- +-- Returns the size of the OpenMW window in pixels as a 2D vector. +-- @function [parent=#ui] screenSize +-- @return openmw.util#Vector2 + --- -- Converts a given table of tables into an @{openmw.ui#Content} -- @function [parent=#ui] content