mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 20:20:25 +02:00
updated to latest love-android (changeset 7b5f223900b)
This commit is contained in:
@@ -75,6 +75,8 @@ public:
|
||||
virtual bool isVisible() const = 0;
|
||||
virtual void setGrabbed(bool grab) = 0;
|
||||
virtual bool isGrabbed() const = 0;
|
||||
virtual bool setRelative(bool relative) = 0;
|
||||
virtual bool isRelative() const = 0;
|
||||
|
||||
static bool getConstant(const char *in, Button &out);
|
||||
static bool getConstant(Button in, const char *&out);
|
||||
|
||||
@@ -220,6 +220,16 @@ bool Mouse::isGrabbed() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Mouse::setRelative(bool relative)
|
||||
{
|
||||
return SDL_SetRelativeMouseMode(relative ? SDL_TRUE : SDL_FALSE) == 0;
|
||||
}
|
||||
|
||||
bool Mouse::isRelative() const
|
||||
{
|
||||
return SDL_GetRelativeMouseMode() != SDL_FALSE;
|
||||
}
|
||||
|
||||
} // sdl
|
||||
} // mouse
|
||||
} // love
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
bool isVisible() const;
|
||||
void setGrabbed(bool grab);
|
||||
bool isGrabbed() const;
|
||||
bool setRelative(bool relative);
|
||||
bool isRelative() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -185,6 +185,19 @@ int w_isGrabbed(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_setRelative(lua_State *L)
|
||||
{
|
||||
bool relative = luax_toboolean(L, 1);
|
||||
luax_pushboolean(L, instance()->setRelative(relative));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_isRelative(lua_State *L)
|
||||
{
|
||||
luax_pushboolean(L, instance()->isRelative());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
@@ -204,6 +217,8 @@ static const luaL_Reg functions[] =
|
||||
{ "getPosition", w_getPosition },
|
||||
{ "setGrabbed", w_setGrabbed },
|
||||
{ "isGrabbed", w_isGrabbed },
|
||||
{ "setRelative", w_setRelative },
|
||||
{ "isRelative", w_isRelative },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ int w_setVisible(lua_State *L);
|
||||
int w_isVisible(lua_State *L);
|
||||
int w_setGrabbed(lua_State *L);
|
||||
int w_isGrabbed(lua_State *L);
|
||||
int w_setRelative(lua_State *L);
|
||||
int w_isRelative(lua_State *L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_mouse(lua_State *L);
|
||||
|
||||
} // mouse
|
||||
|
||||
Reference in New Issue
Block a user