ghostty/pkg/glfw/gamepad_axis.zig
Mitchell Hashimoto 221f905a1c pkg/glfw
Closes #6702

This removes our mach-glfw dependency and replaces it with an in-tree
pkg/glfw that includes both the source for compiling glfw as well as the
Zig bindings. This matches the pattern from our other packages.

This is based on the upstream mach-glfw work and therefore includes the
original license and copyright information.

The reasoning is stated in the issue but to summarize for the commit:

  - mach-glfw is no longer maintained, so we have to take ownership
  - mach-glfw depended on some large blobs of header files to enable
    cross-compilation but this isn't something we actually care about,
    so we can (and do) drop the blobs
  - mach-glfw blobs were hosted on mach hosts. given mach-glfw is
    unmaintained, we can't rely on this hosting
  - mach-glfw relied on a "glfw" package which was owned by another
    person to be Zig 0.14 compatible, but we no longer need to rely on
    this
  - mach-glfw builds were outdated based on latest Zig practices
2025-03-13 20:52:33 -07:00

17 lines
554 B
Zig

const c = @import("c.zig").c;
/// Gamepad axes.
///
/// See glfw.getGamepadState for how these are used.
pub const GamepadAxis = enum(c_int) {
left_x = c.GLFW_GAMEPAD_AXIS_LEFT_X,
left_y = c.GLFW_GAMEPAD_AXIS_LEFT_Y,
right_x = c.GLFW_GAMEPAD_AXIS_RIGHT_X,
right_y = c.GLFW_GAMEPAD_AXIS_RIGHT_Y,
left_trigger = c.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER,
right_trigger = c.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER,
};
/// Not in the GamepadAxis enumeration as it is a duplicate value which is forbidden.
pub const last = GamepadAxis.right_trigger;