mirror of
https://github.com/keharriso/love-nuklear.git
synced 2025-09-10 16:17:47 -04:00
Merge branch 'mouse-presses' of github.com:keharriso/love-nuklear
This commit is contained in:
commit
2fd70e6062
3 changed files with 15 additions and 13 deletions
|
@ -54,12 +54,12 @@ function love.keyreleased(key, scancode)
|
||||||
ui:keyreleased(key, scancode)
|
ui:keyreleased(key, scancode)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousepressed(x, y, button, istouch)
|
function love.mousepressed(x, y, button, istouch, presses)
|
||||||
ui:mousepressed(x, y, button, istouch)
|
ui:mousepressed(x, y, button, istouch, presses)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousereleased(x, y, button, istouch)
|
function love.mousereleased(x, y, button, istouch, presses)
|
||||||
ui:mousereleased(x, y, button, istouch)
|
ui:mousereleased(x, y, button, istouch, presses)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousemoved(x, y, dx, dy, istouch)
|
function love.mousemoved(x, y, dx, dy, istouch)
|
||||||
|
|
|
@ -50,12 +50,12 @@ function love.keyreleased(key, scancode)
|
||||||
input('keyreleased', key, scancode)
|
input('keyreleased', key, scancode)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousepressed(x, y, button, istouch)
|
function love.mousepressed(x, y, button, istouch, presses)
|
||||||
input('mousepressed', x, y, button, istouch)
|
input('mousepressed', x, y, button, istouch, presses)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousereleased(x, y, button, istouch)
|
function love.mousereleased(x, y, button, istouch, presses)
|
||||||
input('mousereleased', x, y, button, istouch)
|
input('mousereleased', x, y, button, istouch, presses)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousemoved(x, y, dx, dy, istouch)
|
function love.mousemoved(x, y, dx, dy, istouch)
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ static int nk_love_keyevent(struct nk_context *ctx, const char *key,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nk_love_clickevent(struct nk_love_context *ctx, int x, int y,
|
static int nk_love_clickevent(struct nk_love_context *ctx, int x, int y,
|
||||||
int button, int istouch, int down)
|
int button, int istouch, int presses, int down)
|
||||||
{
|
{
|
||||||
nk_love_transform(ctx->Ti, &x, &y);
|
nk_love_transform(ctx->Ti, &x, &y);
|
||||||
struct nk_context *nkctx = &ctx->nkctx;
|
struct nk_context *nkctx = &ctx->nkctx;
|
||||||
|
@ -1161,26 +1161,28 @@ static int nk_love_keyreleased(lua_State *L)
|
||||||
|
|
||||||
static int nk_love_mousepressed(lua_State *L)
|
static int nk_love_mousepressed(lua_State *L)
|
||||||
{
|
{
|
||||||
nk_love_assert_argc(lua_gettop(L) == 5);
|
nk_love_assert_argc(lua_gettop(L) == 5 || lua_gettop(L) == 6);
|
||||||
struct nk_love_context *ctx = nk_love_checkcontext(1);
|
struct nk_love_context *ctx = nk_love_checkcontext(1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
int button = luaL_checkint(L, 4);
|
int button = luaL_checkint(L, 4);
|
||||||
int istouch = nk_love_checkboolean(L, 5);
|
int istouch = nk_love_checkboolean(L, 5);
|
||||||
int consume = nk_love_clickevent(ctx, x, y, button, istouch, 1);
|
int presses = lua_gettop(L) == 6 ? luaL_checkint(L, 6) : 1;
|
||||||
|
int consume = nk_love_clickevent(ctx, x, y, button, istouch, presses, 1);
|
||||||
lua_pushboolean(L, consume);
|
lua_pushboolean(L, consume);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nk_love_mousereleased(lua_State *L)
|
static int nk_love_mousereleased(lua_State *L)
|
||||||
{
|
{
|
||||||
nk_love_assert_argc(lua_gettop(L) == 5);
|
nk_love_assert_argc(lua_gettop(L) == 5 || lua_gettop(L) == 6);
|
||||||
struct nk_love_context *ctx = nk_love_checkcontext(1);
|
struct nk_love_context *ctx = nk_love_checkcontext(1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
int button = luaL_checkint(L, 4);
|
int button = luaL_checkint(L, 4);
|
||||||
int istouch = nk_love_checkboolean(L, 5);
|
int istouch = nk_love_checkboolean(L, 5);
|
||||||
int consume = nk_love_clickevent(ctx, x, y, button, istouch, 0);
|
int presses = lua_gettop(L) == 6 ? luaL_checkint(L, 6) : 1;
|
||||||
|
int consume = nk_love_clickevent(ctx, x, y, button, istouch, presses, 0);
|
||||||
lua_pushboolean(L, consume);
|
lua_pushboolean(L, consume);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue