mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Added love.window.isVisible
This commit is contained in:
@@ -78,6 +78,8 @@ public:
|
|||||||
virtual bool hasFocus() const = 0;
|
virtual bool hasFocus() const = 0;
|
||||||
virtual bool hasMouseFocus() const = 0;
|
virtual bool hasMouseFocus() const = 0;
|
||||||
|
|
||||||
|
virtual bool isVisible() const = 0;
|
||||||
|
|
||||||
virtual void setMouseVisible(bool visible) = 0;
|
virtual void setMouseVisible(bool visible) = 0;
|
||||||
virtual bool getMouseVisible() const = 0;
|
virtual bool getMouseVisible() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -310,6 +310,11 @@ bool Window::hasMouseFocus() const
|
|||||||
return (SDL_GetAppState() & SDL_APPMOUSEFOCUS) != 0;
|
return (SDL_GetAppState() & SDL_APPMOUSEFOCUS) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::isVisible() const
|
||||||
|
{
|
||||||
|
return (SDL_GetAppState() & SDL_APPACTIVE) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setMouseVisible(bool visible)
|
void Window::setMouseVisible(bool visible)
|
||||||
{
|
{
|
||||||
SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
|
SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public:
|
|||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
bool hasMouseFocus() const;
|
bool hasMouseFocus() const;
|
||||||
|
|
||||||
|
bool isVisible() const;
|
||||||
|
|
||||||
void setMouseVisible(bool visible);
|
void setMouseVisible(bool visible);
|
||||||
bool getMouseVisible() const;
|
bool getMouseVisible() const;
|
||||||
|
|
||||||
|
|||||||
@@ -214,6 +214,12 @@ int w_hasMouseFocus(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_isVisible(lua_State *L)
|
||||||
|
{
|
||||||
|
luax_pushboolean(L, instance->isVisible());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg functions[] =
|
static const luaL_Reg functions[] =
|
||||||
{
|
{
|
||||||
{ "checkMode", w_checkMode },
|
{ "checkMode", w_checkMode },
|
||||||
@@ -230,6 +236,7 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getTitle", w_getTitle },
|
{ "getTitle", w_getTitle },
|
||||||
{ "hasFocus", w_hasFocus },
|
{ "hasFocus", w_hasFocus },
|
||||||
{ "hasMouseFocus", w_hasMouseFocus },
|
{ "hasMouseFocus", w_hasMouseFocus },
|
||||||
|
{ "isVisible", w_isVisible },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ int w_setTitle(lua_State *L);
|
|||||||
int w_getTitle(lua_State *L);
|
int w_getTitle(lua_State *L);
|
||||||
int w_hasFocus(lua_State *L);
|
int w_hasFocus(lua_State *L);
|
||||||
int w_hasMouseFocus(lua_State *L);
|
int w_hasMouseFocus(lua_State *L);
|
||||||
|
int w_isVisible(lua_State *L);
|
||||||
extern "C" LOVE_EXPORT int luaopen_love_window(lua_State *L);
|
extern "C" LOVE_EXPORT int luaopen_love_window(lua_State *L);
|
||||||
|
|
||||||
} // window
|
} // window
|
||||||
|
|||||||
Reference in New Issue
Block a user