From c02c8b154db18da33fe9e5ba41f6d205635dfdbb Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 17 Feb 2015 02:33:42 -0400 Subject: [PATCH] Added a boolean argument to love.mousepressed and love.mousereleased indicating whether the button event originated from a touchscreen press --HG-- branch : minor --- src/modules/event/sdl/Event.cpp | 1 + src/scripts/boot.lua | 8 ++++---- src/scripts/boot.lua.h | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index faf2150b4..e15c8eb6c 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -255,6 +255,7 @@ Message *Event::convert(const SDL_Event &e) const vargs.push_back(new Variant(x)); vargs.push_back(new Variant(y)); vargs.push_back(new Variant(txt, strlen(txt))); + vargs.push_back(new Variant(e.button.which == SDL_TOUCH_MOUSEID)); msg = new Message((e.type == SDL_MOUSEBUTTONDOWN) ? "mousepressed" : "mousereleased", vargs); diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index a21f3349e..bd6c1a061 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -169,11 +169,11 @@ function love.createhandlers() mousemoved = function (x,y,xrel,yrel) if love.mousemoved then return love.mousemoved(x,y,xrel,yrel) end end, - mousepressed = function (x,y,b) - if love.mousepressed then return love.mousepressed(x,y,b) end + mousepressed = function (x,y,b,t) + if love.mousepressed then return love.mousepressed(x,y,b,t) end end, - mousereleased = function (x,y,b) - if love.mousereleased then return love.mousereleased(x,y,b) end + mousereleased = function (x,y,b,t) + if love.mousereleased then return love.mousereleased(x,y,b,t) end end, wheelmoved = function (x,y) if love.wheelmoved then return love.wheelmoved(x,y) end diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 4183035af..9fce0c1d3 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -294,18 +294,18 @@ const unsigned char boot_lua[] = 0x78, 0x72, 0x65, 0x6c, 0x2c, 0x79, 0x72, 0x65, 0x6c, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x09, 0x09, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x0a, + 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x2c, 0x74, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x28, - 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, + 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x2c, 0x74, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x09, 0x09, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x20, 0x3d, 0x20, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x0a, + 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x2c, 0x74, 0x29, 0x0a, 0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x64, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, + 0x64, 0x28, 0x78, 0x2c, 0x79, 0x2c, 0x62, 0x2c, 0x74, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x2c, 0x0a, 0x09, 0x09, 0x77, 0x68, 0x65, 0x65, 0x6c, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x3d, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x78, 0x2c, 0x79, 0x29, 0x0a,