Skip to content

Commit 7f5f176

Browse files
committed
KeyboardKeyboard WIP
1 parent 8af4e4f commit 7f5f176

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

Plugins/CS/Keyboard.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public static class Keyboard
2121
[DllImport("__Internal")] static extern bool Keyboard_IsKeyboardSupported();
2222
[DllImport("__Internal")] static extern bool Keyboard_IsAnyKeyPressed();
2323

24+
public static bool IsKeyboardSupported() => Keyboard_IsKeyboardSupported();
25+
public static bool IsAnyKeyPressed() => Keyboard_IsAnyKeyPressed();
26+
2427
public static event Action<KeyCode> OnKeyPressed;
2528
public static event Action<KeyCode> OnKeyReleased;
2629

Plugins/Native/Headers/Keyboard.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#import "../Utils.mm"
22
#import <GameController/GameController.h>
3+
34
@interface Keyboard : NSObject
5+
+(void)RegisterKeyPressCallback:(LongCallback)callback;
6+
+(void)RegisterKeyReleaseCallback:(LongCallback)callback;
7+
+(BOOL)IsKeyboardSupported;
8+
+(BOOL)IsAnyKeyPressed;
9+
@end
410

11+
extern "C"
12+
{
513

6-
@end
14+
void Keyboard_RegisterKeyPressCallback(LongCallback callback)
15+
{
16+
[Keyboard RegisterKeyPressCallback:callback];
17+
}
18+
19+
void Keyboard_RegisterKeyReleaseCallback(LongCallback callback)
20+
{
21+
[Keyboard RegisterKeyReleaseCallback:callback];
22+
}
23+
24+
bool Keyboard_IsKeyboardSupported()
25+
{
26+
return [Keyboard IsKeyboardSupported];
27+
}
28+
29+
bool Keyboard_IsAnyKeyPressed()
30+
{
31+
return [Keyboard IsAnyKeyPressed];
32+
}
33+
}

0 commit comments

Comments
 (0)