Merge pull request #1579 from ShaharMS/develop

Implement `clickCount` on HTML5 and Native.
This commit is contained in:
player-03
2022-10-10 13:32:34 -04:00
committed by GitHub
7 changed files with 30 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ namespace lime {
int windowID;
double x;
double y;
int clickCount;
static ValuePointer* callback;
static ValuePointer* eventObject;

View File

@@ -4000,7 +4000,7 @@ namespace lime {
#define _TGAMEPAD_EVENT _OBJ (_I32 _I32 _I32 _I32 _F64)
#define _TJOYSTICK_EVENT _OBJ (_I32 _I32 _I32 _I32 _F64 _F64)
#define _TKEY_EVENT _OBJ (_F64 _I32 _I32 _I32)
#define _TMOUSE_EVENT _OBJ (_I32 _F64 _F64 _I32 _I32 _F64 _F64)
#define _TMOUSE_EVENT _OBJ (_I32 _F64 _F64 _I32 _I32 _F64 _F64 _I32)
#define _TRECTANGLE _OBJ (_F64 _F64 _F64 _F64)
#define _TRENDER_EVENT _OBJ (_I32)
#define _TSENSOR_EVENT _OBJ (_I32 _F64 _F64 _F64 _I32)

View File

@@ -622,6 +622,7 @@ namespace lime {
mouseEvent.button = event->button.button - 1;
mouseEvent.x = event->button.x;
mouseEvent.y = event->button.y;
mouseEvent.clickCount = event->button.clicks;
break;
case SDL_MOUSEBUTTONUP:
@@ -632,6 +633,7 @@ namespace lime {
mouseEvent.button = event->button.button - 1;
mouseEvent.x = event->button.x;
mouseEvent.y = event->button.y;
mouseEvent.clickCount = event->button.clicks;
break;
case SDL_MOUSEWHEEL:

View File

@@ -15,6 +15,7 @@ namespace lime {
static int id_windowID;
static int id_x;
static int id_y;
static int id_clickCount;
static bool init = false;
@@ -27,6 +28,7 @@ namespace lime {
y = 0.0;
movementX = 0.0;
movementY = 0.0;
clickCount = 0;
}
@@ -46,6 +48,7 @@ namespace lime {
id_windowID = val_id ("windowID");
id_x = val_id ("x");
id_y = val_id ("y");
id_clickCount = val_id ("clickCount");
init = true;
}
@@ -55,7 +58,11 @@ namespace lime {
if (event->type != MOUSE_WHEEL) {
alloc_field (object, id_button, alloc_int (event->button));
}
if (event->type != MOUSE_WHEEL && event->type != MOUSE_MOVE) {
alloc_field (object, id_clickCount, alloc_int (event->clickCount));
}
alloc_field (object, id_movementX, alloc_float (event->movementX));
@@ -76,6 +83,7 @@ namespace lime {
eventObject->windowID = event->windowID;
eventObject->x = event->x;
eventObject->y = event->y;
eventObject->clickCount = event->clickCount;
}
@@ -86,4 +94,4 @@ namespace lime {
}
}
}