Added love.mouse.hasCursor. Returns true if mouse cursors are available.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-16 00:21:39 -04:00
parent 1f726b2fa1
commit 8edea22179
5 changed files with 18 additions and 0 deletions
+2
View File
@@ -60,6 +60,8 @@ public:
virtual Cursor *getCursor() const = 0;
virtual bool hasCursor() const = 0;
virtual int getX() const = 0;
virtual int getY() const = 0;
virtual void getPosition(int &x, int &y) const = 0;
+6
View File
@@ -112,6 +112,12 @@ love::mouse::Cursor *Mouse::getCursor() const
return curCursor.get();
}
bool Mouse::hasCursor() const
{
return SDL_GetDefaultCursor() != nullptr;
}
int Mouse::getX() const
{
int x;
+2
View File
@@ -53,6 +53,8 @@ public:
love::mouse::Cursor *getCursor() const;
bool hasCursor() const;
int getX() const;
int getY() const;
void getPosition(int &x, int &y) const;
+7
View File
@@ -91,6 +91,12 @@ int w_getCursor(lua_State *L)
return 1;
}
int w_hasCursor(lua_State *L)
{
luax_pushboolean(L, instance()->hasCursor());
return 1;
}
int w_getX(lua_State *L)
{
lua_pushnumber(L, instance()->getX());
@@ -199,6 +205,7 @@ static const luaL_Reg functions[] =
{ "getSystemCursor", w_getSystemCursor },
{ "setCursor", w_setCursor },
{ "getCursor", w_getCursor },
{ "hasCursor", w_hasCursor },
{ "getX", w_getX },
{ "getY", w_getY },
{ "setX", w_setX },
+1
View File
@@ -34,6 +34,7 @@ int w_newCursor(lua_State *L);
int w_getSystemCursor(lua_State *L);
int w_setCursor(lua_State *L);
int w_getCursor(lua_State *L);
int w_hasCursor(lua_State *L);
int w_getX(lua_State *L);
int w_getY(lua_State *L);
int w_getPosition(lua_State *L);