Skip to content

Commit

Permalink
Fix precise input handling on Hashlink.
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric committed Jan 13, 2024
1 parent 17086ec commit 1e2fb6f
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
Binary file added ndll/Windows64/lime-debug.hdll
Binary file not shown.
1 change: 1 addition & 0 deletions ndll/Windows64/lime-debug.hdll.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
90ae44edd718c2bf01e4130b3e67730e
Binary file modified ndll/Windows64/lime.hdll
Binary file not shown.
2 changes: 1 addition & 1 deletion ndll/Windows64/lime.hdll.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9c73bb03c1057c7d17c9bd2d79acefa2
68c4e5a0f69bac555da41680488684bc
2 changes: 1 addition & 1 deletion project/include/system/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace lime {

static void GCEnterBlocking ();
static void GCExitBlocking ();
static long GetTicks ();
static int GetTicks ();
static bool GetAllowScreenTimeout ();
static std::wstring* GetDeviceModel ();
static std::wstring* GetDeviceVendor ();
Expand Down
10 changes: 5 additions & 5 deletions project/src/ExternalInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2665,14 +2665,14 @@ namespace lime {

int lime_sdl_get_ticks () {

return System::GetTicks ();
return System::GetTicks();

}


HL_PRIM int HL_NAME(hl_sdl_get_ticks) () {

return System::GetTicks ();
return System::GetTicks();

}

Expand Down Expand Up @@ -4014,9 +4014,9 @@ namespace lime {
#define _TCLIPBOARD_EVENT _OBJ (_I32)
#define _TDISPLAYMODE _OBJ (_I32 _I32 _I32 _I32)
#define _TDROP_EVENT _OBJ (_BYTES _I32)
#define _TGAMEPAD_EVENT _OBJ (_I32 _I32 _I32 _I32 _F64)
#define _TGAMEPAD_EVENT _OBJ (_I32 _I32 _I32 _I32 _F64 _I32)
#define _TJOYSTICK_EVENT _OBJ (_I32 _I32 _I32 _I32 _F64 _F64)
#define _TKEY_EVENT _OBJ (_F64 _I32 _I32 _I32)
#define _TKEY_EVENT _OBJ (_F64 _I32 _I32 _I32 _I32)
#define _TMOUSE_EVENT _OBJ (_I32 _F64 _F64 _I32 _I32 _F64 _F64)
#define _TRECTANGLE _OBJ (_F64 _F64 _F64 _F64)
#define _TRENDER_EVENT _OBJ (_I32)
Expand Down Expand Up @@ -4130,7 +4130,7 @@ namespace lime {
DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_png_decode_bytes, _TBYTES _BOOL _TIMAGEBUFFER);
DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_png_decode_file, _STRING _BOOL _TIMAGEBUFFER);
DEFINE_HL_PRIM (_VOID, hl_render_event_manager_register, _FUN (_VOID, _NO_ARG) _TRENDER_EVENT);
DEFINE_HL_PRIM (_I64, hl_sdl_get_ticks, _FUN (_VOID, _NO_ARG) _TRENDER_EVENT);
DEFINE_HL_PRIM (_I32, hl_sdl_get_ticks, _NO_ARG);
DEFINE_HL_PRIM (_VOID, hl_sensor_event_manager_register, _FUN (_VOID, _NO_ARG) _TSENSOR_EVENT);
DEFINE_HL_PRIM (_BOOL, hl_system_get_allow_screen_timeout, _NO_ARG);
DEFINE_HL_PRIM (_BYTES, hl_system_get_device_model, _NO_ARG);
Expand Down
2 changes: 1 addition & 1 deletion project/src/backend/sdl/SDLSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace lime {
}


long System::GetTicks () {
int System::GetTicks () {

return SDL_GetTicks ();

Expand Down
1 change: 1 addition & 0 deletions project/src/ui/GamepadEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace lime {
eventObject->id = event->id;
eventObject->type = event->type;
eventObject->axisValue = event->axisValue;
eventObject->timestamp = event->timestamp;

}

Expand Down
15 changes: 8 additions & 7 deletions src/lime/_internal/backend/native/NativeApplication.hx
Original file line number Diff line number Diff line change
Expand Up @@ -709,18 +709,18 @@ class NativeApplication
* The timestamp, in milliseconds, of when the event occurred.
* Relative to `lime_sdl_get_ticks()`
* May be `0` if timestamp could not be determined.
* TODO: Replace with `Int64` when I figure out how to return one from HashLink
*/
public var timestamp:Int64;
public var timestamp:Int;

public function new(type:GamepadEventType = null, id:Int = 0, button:Int = 0, axis:Int = 0, value:Float = 0, timestamp:Null<Int64> = null)
public function new(type:GamepadEventType = null, id:Int = 0, button:Int = 0, axis:Int = 0, value:Float = 0, ?timestamp:Int = 0)
{
this.type = type;
this.id = id;
this.button = button;
this.axis = axis;
this.axisValue = value;

this.timestamp = timestamp == null ? Int64.ofInt(0) : timestamp;
this.timestamp = timestamp;
}

public function clone():GamepadEventInfo
Expand Down Expand Up @@ -784,16 +784,17 @@ class NativeApplication
* The timestamp, in milliseconds, of when the event occurred.
* Relative to `lime_sdl_get_ticks()`
* May be `0` if timestamp could not be determined.
* TODO: Replace with `Int64` when I figure out how to return one from HashLink
*/
public var timestamp:Int64;
public var timestamp:Int;

public function new(type:KeyEventType = null, windowID:Int = 0, keyCode: Float = 0, modifier:Int = 0, timestamp:Null<Int64> = null)
public function new(type:KeyEventType = null, windowID:Int = 0, keyCode: Float = 0, modifier:Int = 0, ?timestamp:Int = 0)
{
this.type = type;
this.windowID = windowID;
this.keyCode = keyCode;
this.modifier = modifier;
this.timestamp = timestamp == null ? Int64.ofInt(0) : timestamp;
this.timestamp = timestamp;
}

public function clone():KeyEventInfo
Expand Down

0 comments on commit 1e2fb6f

Please sign in to comment.