36 lines
1.2 KiB
Zig
36 lines
1.2 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const TouchID = u64;
|
|
|
|
pub const FingerID = u64;
|
|
|
|
pub const TouchDeviceType = enum(c_int) {
|
|
touchDeviceDirect, //touch screen with window-relative coordinates
|
|
touchDeviceIndirectAbsolute, //trackpad with absolute device coordinates
|
|
touchDeviceIndirectRelative, //trackpad with screen cursor-relative coordinates
|
|
};
|
|
|
|
pub const Finger = extern struct {
|
|
id: FingerID, // the finger ID
|
|
x: f32, // the x-axis location of the touch event, normalized (0...1)
|
|
y: f32, // the y-axis location of the touch event, normalized (0...1)
|
|
pressure: f32, // the quantity of pressure applied, normalized (0...1)
|
|
};
|
|
|
|
pub inline fn getTouchDevices(count: *c_int) ?*TouchID {
|
|
return @ptrCast(c.SDL_GetTouchDevices(@ptrCast(count)));
|
|
}
|
|
|
|
pub inline fn getTouchDeviceName(touchID: TouchID) [*c]const u8 {
|
|
return c.SDL_GetTouchDeviceName(touchID);
|
|
}
|
|
|
|
pub inline fn getTouchDeviceType(touchID: TouchID) TouchDeviceType {
|
|
return @intFromEnum(c.SDL_GetTouchDeviceType(touchID));
|
|
}
|
|
|
|
pub inline fn getTouchFingers(touchID: TouchID, count: *c_int) [*c]?*Finger {
|
|
return c.SDL_GetTouchFingers(touchID, @ptrCast(count));
|
|
}
|