Merge branch 'develop' into 8.3.0-Dev

This commit is contained in:
Josh Tynjala
2025-09-18 09:42:54 -07:00
5 changed files with 75 additions and 16 deletions

View File

@@ -2490,28 +2490,28 @@ namespace lime {
}
float lime_key_code_from_scan_code (float scanCode) {
int lime_key_code_from_scan_code (int scanCode) {
return KeyCode::FromScanCode (scanCode);
}
HL_PRIM float HL_NAME(hl_key_code_from_scan_code) (float scanCode) {
HL_PRIM int HL_NAME(hl_key_code_from_scan_code) (int scanCode) {
return KeyCode::FromScanCode (scanCode);
}
float lime_key_code_to_scan_code (float keyCode) {
int lime_key_code_to_scan_code (int keyCode) {
return KeyCode::ToScanCode (keyCode);
}
HL_PRIM float HL_NAME(hl_key_code_to_scan_code) (float keyCode) {
HL_PRIM int HL_NAME(hl_key_code_to_scan_code) (int keyCode) {
return KeyCode::ToScanCode (keyCode);
@@ -4300,8 +4300,8 @@ namespace lime {
DEFINE_HL_PRIM (_I32, hl_joystick_get_num_hats, _I32);
DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_bytes, _TBYTES _BOOL _TIMAGEBUFFER);
DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_file, _STRING _BOOL _TIMAGEBUFFER);
DEFINE_HL_PRIM (_F32, hl_key_code_from_scan_code, _F32);
DEFINE_HL_PRIM (_F32, hl_key_code_to_scan_code, _F32);
DEFINE_HL_PRIM (_I32, hl_key_code_from_scan_code, _I32);
DEFINE_HL_PRIM (_I32, hl_key_code_to_scan_code, _I32);
DEFINE_HL_PRIM (_VOID, hl_key_event_manager_register, _FUN (_VOID, _NO_ARG) _TKEY_EVENT);
DEFINE_HL_PRIM (_BYTES, hl_locale_get_system_locale, _NO_ARG);
DEFINE_HL_PRIM (_TBYTES, hl_lzma_compress, _TBYTES _TBYTES);

View File

@@ -225,9 +225,9 @@ class NativeCFFI
@:cffi private static function lime_jpeg_decode_file(path:String, decodeData:Bool, buffer:Dynamic):Dynamic;
@:cffi private static function lime_key_code_from_scan_code(scanCode:Float32):Float32;
@:cffi private static function lime_key_code_from_scan_code(scanCode:Int):Int;
@:cffi private static function lime_key_code_to_scan_code(keyCode:Float32):Float32;
@:cffi private static function lime_key_code_to_scan_code(keyCode:Int):Int;
@:cffi private static function lime_key_event_manager_register(callback:Dynamic, eventObject:Dynamic):Void;
@@ -515,10 +515,10 @@ class NativeCFFI
"lime_jpeg_decode_bytes", "oboo", false));
private static var lime_jpeg_decode_file = new cpp.Callable<String->Bool->cpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_jpeg_decode_file",
"sboo", false));
private static var lime_key_code_from_scan_code = new cpp.Callable<cpp.Float32->cpp.Float32>(cpp.Prime._loadPrime("lime", "lime_key_code_from_scan_code",
"ff", false));
private static var lime_key_code_to_scan_code = new cpp.Callable<cpp.Float32->cpp.Float32>(cpp.Prime._loadPrime("lime", "lime_key_code_to_scan_code",
"ff", false));
private static var lime_key_code_from_scan_code = new cpp.Callable<Int->Int>(cpp.Prime._loadPrime("lime", "lime_key_code_from_scan_code",
"ii", false));
private static var lime_key_code_to_scan_code = new cpp.Callable<Int->Int>(cpp.Prime._loadPrime("lime", "lime_key_code_to_scan_code",
"ii", false));
private static var lime_key_event_manager_register = new cpp.Callable<cpp.Object->cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime",
"lime_key_event_manager_register", "oov", false));
private static var lime_lzma_compress = new cpp.Callable<cpp.Object->cpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_lzma_compress", "ooo",
@@ -1157,12 +1157,12 @@ class NativeCFFI
return null;
}
@:hlNative("lime", "hl_key_code_from_scan_code") private static function lime_key_code_from_scan_code(scanCode:hl.F32):hl.F32
@:hlNative("lime", "hl_key_code_from_scan_code") private static function lime_key_code_from_scan_code(scanCode:Int):Int
{
return 0;
}
@:hlNative("lime", "hl_key_code_to_scan_code") private static function lime_key_code_to_scan_code(keyCode:hl.F32):hl.F32
@:hlNative("lime", "hl_key_code_to_scan_code") private static function lime_key_code_to_scan_code(keyCode:Int):Int
{
return 0;
}

View File

@@ -2,6 +2,14 @@ package lime.ui;
import lime._internal.backend.native.NativeCFFI;
/**
Used by keyboard event listeners to identify which key was pressed
down or released.
@see `lime.ui.Window.onKeyDown`
@see `lime.ui.Window.onKeyUp`
@see `lime.ui.ScanCode`
**/
@:access(lime._internal.backend.native.NativeCFFI)
#if (haxe_ver >= 4.0) enum #else @:enum #end abstract KeyCode(Int) from Int to Int from UInt to UInt
{
@@ -246,7 +254,7 @@ import lime._internal.backend.native.NativeCFFI;
{
#if (lime_cffi && !macro)
var code:Int = scanCode;
return Std.int(NativeCFFI.lime_key_code_from_scan_code(code));
return NativeCFFI.lime_key_code_from_scan_code(code);
#else
return KeyCode.UNKNOWN;
#end
@@ -256,7 +264,7 @@ import lime._internal.backend.native.NativeCFFI;
{
#if (lime_cffi && !macro)
var code:Int = keyCode;
return Std.int(NativeCFFI.lime_key_code_to_scan_code(code));
return NativeCFFI.lime_key_code_to_scan_code(code);
#else
return ScanCode.UNKNOWN;
#end

View File

@@ -2,6 +2,14 @@ package lime.ui;
import lime._internal.backend.native.NativeCFFI;
/**
May be used to identify the scan code associated with the `KeyCode` passed
to keyboard event listeners.
@see `lime.ui.Window.onKeyDown`
@see `lime.ui.Window.onKeyUp`
@see `lime.ui.KeyCode`
**/
@:access(lime._internal.backend.native.NativeCFFI)
@:access(lime.ui.KeyCode)
#if (haxe_ver >= 4.0) enum #else @:enum #end abstract ScanCode(Int) from Int to Int from UInt to UInt

View File

@@ -67,25 +67,68 @@ class Window
public var onFocusOut(default, null) = new Event<Void->Void>();
public var onFullscreen(default, null) = new Event<Void->Void>();
public var onHide(default, null) = new Event<Void->Void>();
/**
Fired when the user presses a key down when this window has focus.
**/
public var onKeyDown(default, null) = new Event<KeyCode->KeyModifier->Void>();
/**
Fired when the user releases a key that was down.
**/
public var onKeyUp(default, null) = new Event<KeyCode->KeyModifier->Void>();
public var onLeave(default, null) = new Event<Void->Void>();
/**
Fired when the window is maximized.
**/
public var onMaximize(default, null) = new Event<Void->Void>();
/**
Fired when the window is minimized.
**/
public var onMinimize(default, null) = new Event<Void->Void>();
/**
Fired when the user pressed a mouse button down.
**/
public var onMouseDown(default, null) = new Event<Float->Float->MouseButton->Void>();
/**
Fired when the mouse is moved over the window.
**/
public var onMouseMove(default, null) = new Event<Float->Float->Void>();
public var onMouseMoveRelative(default, null) = new Event<Float->Float->Void>();
/**
Fired when the user releases a mouse button that was pressed down.
**/
public var onMouseUp(default, null) = new Event<Float->Float->Int->Void>();
/**
Fired when the user interacts with the mouse wheel.
**/
public var onMouseWheel(default, null) = new Event<Float->Float->MouseWheelMode->Void>();
/**
Fired when the window is moved to a new position.
**/
public var onMove(default, null) = new Event<Float->Float->Void>();
public var onRender(default, null) = new Event<RenderContext->Void>();
public var onRenderContextLost(default, null) = new Event<Void->Void>();
public var onRenderContextRestored(default, null) = new Event<RenderContext->Void>();
/**
Fired when the window is resized with new dimensions.
**/
public var onResize(default, null) = new Event<Int->Int->Void>();
public var onRestore(default, null) = new Event<Void->Void>();
public var onShow(default, null) = new Event<Void->Void>();
public var onTextEdit(default, null) = new Event<String->Int->Int->Void>();
public var onTextInput(default, null) = new Event<String->Void>();
public var opacity(get, set):Float;
public var parameters:Dynamic;
public var resizable(get, set):Bool;