mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
add love.exposed and love.occluded event callbacks.
Add love.window.isOccluded. Resolves #2004.
This commit is contained in:
@@ -187,6 +187,7 @@ public:
|
||||
virtual bool hasMouseFocus() const = 0;
|
||||
|
||||
virtual bool isVisible() const = 0;
|
||||
virtual bool isOccluded() const = 0;
|
||||
|
||||
virtual void setMouseGrab(bool grab) = 0;
|
||||
virtual bool isMouseGrabbed() const = 0;
|
||||
|
||||
@@ -1298,6 +1298,11 @@ bool Window::isVisible() const
|
||||
return window && (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED)) == 0;
|
||||
}
|
||||
|
||||
bool Window::isOccluded() const
|
||||
{
|
||||
return window && (SDL_GetWindowFlags(window) & SDL_WINDOW_OCCLUDED) != 0;
|
||||
}
|
||||
|
||||
void Window::setMouseGrab(bool grab)
|
||||
{
|
||||
mouseGrabbed = grab;
|
||||
|
||||
@@ -98,6 +98,7 @@ public:
|
||||
bool hasMouseFocus() const override;
|
||||
|
||||
bool isVisible() const override;
|
||||
bool isOccluded() const override;
|
||||
|
||||
void setMouseGrab(bool grab) override;
|
||||
bool isMouseGrabbed() const override;
|
||||
|
||||
@@ -486,6 +486,12 @@ int w_isVisible(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_isOccluded(lua_State *L)
|
||||
{
|
||||
luax_pushboolean(L, instance()->isOccluded());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getDPIScale(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, instance()->getDPIScale());
|
||||
@@ -683,6 +689,7 @@ static const luaL_Reg functions[] =
|
||||
{ "hasFocus", w_hasFocus },
|
||||
{ "hasMouseFocus", w_hasMouseFocus },
|
||||
{ "isVisible", w_isVisible },
|
||||
{ "isOccluded", w_isOccluded },
|
||||
{ "getDPIScale", w_getDPIScale },
|
||||
{ "getNativeDPIScale", w_getNativeDPIScale },
|
||||
{ "toPixels", w_toPixels },
|
||||
|
||||
Reference in New Issue
Block a user