Make Gesture a packed struct (#284)

This commit is contained in:
Nikolas 2025-09-11 19:24:15 +02:00
parent 651b37a025
commit 33f216d4fc
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
3 changed files with 37 additions and 27 deletions

View File

@ -56,7 +56,7 @@ pub fn main() anyerror!void {
// TODO: Update `title` state variables here! // TODO: Update `title` state variables here!
// Press ENTER to change to `gameplay` state // Press ENTER to change to `gameplay` state
if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.tap)) { if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.{ .tap = true })) {
current_screen = .gameplay; current_screen = .gameplay;
} }
}, },
@ -64,7 +64,7 @@ pub fn main() anyerror!void {
// TODO: Update `gameplay` state variables here! // TODO: Update `gameplay` state variables here!
// Press ENTER to change to `ending` state // Press ENTER to change to `ending` state
if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.tap)) { if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.{ .tap = true })) {
current_screen = .ending; current_screen = .ending;
} }
}, },
@ -72,7 +72,7 @@ pub fn main() anyerror!void {
// TODO: Update `ending` state variables here! // TODO: Update `ending` state variables here!
// Press ENTER to return to `title` state // Press ENTER to return to `title` state
if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.tap)) { if (rl.isKeyPressed(.enter) or rl.isGestureDetected(.{ .tap = true })) {
current_screen = .title; current_screen = .title;
} }
}, },

View File

@ -1998,18 +1998,23 @@ pub const BlendMode = enum(c_int) {
custom_separate = 7, custom_separate = 7,
}; };
pub const Gesture = enum(c_int) { pub const Gesture = packed struct {
none = 0, tap: bool = false,
tap = 1, doubletap: bool = false,
doubletap = 2, hold: bool = false,
hold = 4, drag: bool = false,
drag = 8, swipe_right: bool = false,
swipe_right = 16, swipe_left: bool = false,
swipe_left = 32, swipe_up: bool = false,
swipe_up = 64, swipe_down: bool = false,
swipe_down = 128, pinch_in: bool = false,
pinch_in = 256, pinch_out: bool = false,
pinch_out = 512, __reserved1: bool = false,
__reserved2: bool = false,
__reserved3: bool = false,
__reserved4: bool = false,
__reserved5: bool = false,
__reserved6: bool = false,
}; };
pub const CameraMode = enum(c_int) { pub const CameraMode = enum(c_int) {

View File

@ -1998,18 +1998,23 @@ pub const BlendMode = enum(c_int) {
custom_separate = 7, custom_separate = 7,
}; };
pub const Gesture = enum(c_int) { pub const Gesture = packed struct {
none = 0, tap: bool = false,
tap = 1, doubletap: bool = false,
doubletap = 2, hold: bool = false,
hold = 4, drag: bool = false,
drag = 8, swipe_right: bool = false,
swipe_right = 16, swipe_left: bool = false,
swipe_left = 32, swipe_up: bool = false,
swipe_up = 64, swipe_down: bool = false,
swipe_down = 128, pinch_in: bool = false,
pinch_in = 256, pinch_out: bool = false,
pinch_out = 512, __reserved1: bool = false,
__reserved2: bool = false,
__reserved3: bool = false,
__reserved4: bool = false,
__reserved5: bool = false,
__reserved6: bool = false,
}; };
pub const CameraMode = enum(c_int) { pub const CameraMode = enum(c_int) {