1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Merge branch 'screen_size' into 'master'

Add Lua function `ui.screenSize()`

See merge request OpenMW/openmw!1720
This commit is contained in:
uramer 2022-03-20 11:27:29 +00:00
commit 4be1e3deb1
2 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,8 @@
#include <components/lua_ui/alignment.hpp>
#include <components/lua_ui/resources.hpp>
#include <components/settings/settings.hpp>
#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);
}
}

View File

@ -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