40 lines
1.9 KiB
Zig
40 lines
1.9 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
pub const PenID = u32;
|
|
|
|
pub const PenInputFlags = packed struct(u32) {
|
|
penInputDown: bool = false, // pen is pressed down
|
|
penInputButton1: bool = false, // button 1 is pressed
|
|
penInputButton2: bool = false, // button 2 is pressed
|
|
penInputButton3: bool = false, // button 3 is pressed
|
|
penInputButton4: bool = false, // button 4 is pressed
|
|
penInputButton5: bool = false, // button 5 is pressed
|
|
pad0: u24 = 0,
|
|
penInputEraserTip: bool = false, // eraser tip is used
|
|
penInputInProximity: bool = false, // pen is in proximity (since SDL 3.4.0)
|
|
|
|
pub const None = PenInputFlags{};
|
|
};
|
|
|
|
pub const PenAxis = enum(c_int) {
|
|
penAxisPressure, //Pen pressure. Unidirectional: 0 to 1.0
|
|
penAxisXtilt, //Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right).
|
|
penAxisYtilt, //Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down).
|
|
penAxisDistance, //Pen distance to drawing surface. Unidirectional: 0.0 to 1.0
|
|
penAxisRotation, //Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down).
|
|
penAxisSlider, //Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0
|
|
penAxisTangentialPressure, //Pressure from squeezing the pen ("barrel pressure").
|
|
penAxisCount, //Total known pen axis types in this version of SDL. This number may grow in future releases!
|
|
};
|
|
|
|
pub const PenDeviceType = enum(c_int) {
|
|
penDeviceTypeInvalid = -1, //Not a valid pen device.
|
|
penDeviceTypeUnknown, //Don't know specifics of this pen.
|
|
penDeviceTypeDirect, //Pen touches display.
|
|
penDeviceTypeIndirect, //Pen touches something that isn't the display.
|
|
};
|
|
|
|
pub inline fn getPenDeviceType(instance_id: PenID) PenDeviceType {
|
|
return @fromBackingInt(@intCast(c.SDL_GetPenDeviceType(instance_id)));
|
|
}
|