mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Added love.mouse.hasCursor. Returns true if mouse cursors are available.
--HG-- branch : minor
This commit is contained in:
@@ -60,6 +60,8 @@ public:
|
|||||||
|
|
||||||
virtual Cursor *getCursor() const = 0;
|
virtual Cursor *getCursor() const = 0;
|
||||||
|
|
||||||
|
virtual bool hasCursor() const = 0;
|
||||||
|
|
||||||
virtual int getX() const = 0;
|
virtual int getX() const = 0;
|
||||||
virtual int getY() const = 0;
|
virtual int getY() const = 0;
|
||||||
virtual void getPosition(int &x, int &y) const = 0;
|
virtual void getPosition(int &x, int &y) const = 0;
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ love::mouse::Cursor *Mouse::getCursor() const
|
|||||||
return curCursor.get();
|
return curCursor.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Mouse::hasCursor() const
|
||||||
|
{
|
||||||
|
return SDL_GetDefaultCursor() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int Mouse::getX() const
|
int Mouse::getX() const
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
love::mouse::Cursor *getCursor() const;
|
love::mouse::Cursor *getCursor() const;
|
||||||
|
|
||||||
|
bool hasCursor() const;
|
||||||
|
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
void getPosition(int &x, int &y) const;
|
void getPosition(int &x, int &y) const;
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ int w_getCursor(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_hasCursor(lua_State *L)
|
||||||
|
{
|
||||||
|
luax_pushboolean(L, instance()->hasCursor());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int w_getX(lua_State *L)
|
int w_getX(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, instance()->getX());
|
lua_pushnumber(L, instance()->getX());
|
||||||
@@ -199,6 +205,7 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getSystemCursor", w_getSystemCursor },
|
{ "getSystemCursor", w_getSystemCursor },
|
||||||
{ "setCursor", w_setCursor },
|
{ "setCursor", w_setCursor },
|
||||||
{ "getCursor", w_getCursor },
|
{ "getCursor", w_getCursor },
|
||||||
|
{ "hasCursor", w_hasCursor },
|
||||||
{ "getX", w_getX },
|
{ "getX", w_getX },
|
||||||
{ "getY", w_getY },
|
{ "getY", w_getY },
|
||||||
{ "setX", w_setX },
|
{ "setX", w_setX },
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ int w_newCursor(lua_State *L);
|
|||||||
int w_getSystemCursor(lua_State *L);
|
int w_getSystemCursor(lua_State *L);
|
||||||
int w_setCursor(lua_State *L);
|
int w_setCursor(lua_State *L);
|
||||||
int w_getCursor(lua_State *L);
|
int w_getCursor(lua_State *L);
|
||||||
|
int w_hasCursor(lua_State *L);
|
||||||
int w_getX(lua_State *L);
|
int w_getX(lua_State *L);
|
||||||
int w_getY(lua_State *L);
|
int w_getY(lua_State *L);
|
||||||
int w_getPosition(lua_State *L);
|
int w_getPosition(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user