diff --git a/src/Core.zig b/src/Core.zig index b46d9780..a2b8a661 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -429,8 +429,6 @@ pub const Event = union(enum) { xoffset: f32, yoffset: f32, }, - joystick_connected: Joystick, - joystick_disconnected: Joystick, framebuffer_resize: Size, focus_gained, focus_lost, @@ -604,10 +602,6 @@ pub const KeyMods = packed struct(u8) { _padding: u2 = 0, }; -pub const Joystick = enum(u8) { - zero, -}; - pub inline fn pollEvents(core: *@This()) EventIterator { return .{ .platform = core.platform.pollEvents() }; } @@ -779,45 +773,6 @@ pub inline fn cursorShape(core: *@This()) CursorShape { return core.platform.cursorShape(); } -// TODO(feature): add joystick/gamepad support https://github.com/hexops/mach/issues/884 - -// /// Checks if the given joystick is still connected. -// pub inline fn joystickPresent(joystick: Joystick) bool { -// return internal.joystickPresent(joystick); -// } - -// /// Retreives the name of the joystick. -// /// Returns `null` if the joystick isnt connected. -// pub inline fn joystickName(joystick: Joystick) ?[:0]const u8 { -// return internal.joystickName(joystick); -// } - -// /// Retrieves the state of the buttons of the given joystick. -// /// A value of `true` indicates the button is pressed, `false` the button is released. -// /// No remapping is done, so the order of these buttons are joystick-dependent and should be -// /// consistent across platforms. -// /// -// /// Returns `null` if the joystick isnt connected. -// /// -// /// Note: For WebAssembly, the remapping is done directly by the web browser, so on that platform -// /// the order of these buttons might be different than on others. -// pub inline fn joystickButtons(joystick: Joystick) ?[]const bool { -// return internal.joystickButtons(joystick); -// } - -// /// Retreives the state of the axes of the given joystick. -// /// The values are always from -1 to 1. -// /// No remapping is done, so the order of these axes are joytstick-dependent and should be -// /// consistent acrsoss platforms. -// /// -// /// Returns `null` if the joystick isnt connected. -// /// -// /// Note: For WebAssembly, the remapping is done directly by the web browser, so on that platform -// /// the order of these axes might be different than on others. -// pub inline fn joystickAxes(joystick: Joystick) ?[]const f32 { -// return internal.joystickAxes(joystick); -// } - pub inline fn keyPressed(core: *@This(), key: Key) bool { return core.platform.keyPressed(key); } @@ -1133,11 +1088,6 @@ comptime { assertHasDecl(Platform, "setCursorShape"); assertHasField(Platform, "cursor_shape"); - assertHasDecl(Platform, "joystickPresent"); - assertHasDecl(Platform, "joystickName"); - assertHasDecl(Platform, "joystickButtons"); - assertHasDecl(Platform, "joystickAxes"); - assertHasDecl(Platform, "keyPressed"); assertHasDecl(Platform, "keyReleased"); assertHasDecl(Platform, "mousePressed"); @@ -1170,5 +1120,4 @@ test { @import("std").testing.refAllDeclsRecursive(DisplayMode); @import("std").testing.refAllDeclsRecursive(CursorMode); @import("std").testing.refAllDeclsRecursive(CursorShape); - @import("std").testing.refAllDeclsRecursive(Joystick); } diff --git a/src/core/Darwin.zig b/src/core/Darwin.zig index 6c81d256..2f80d733 100644 --- a/src/core/Darwin.zig +++ b/src/core/Darwin.zig @@ -15,7 +15,6 @@ const CursorMode = Core.CursorMode; const Position = Core.Position; const Key = Core.Key; const KeyMods = Core.KeyMods; -const Joystick = Core.Joystick; const objc = @import("objc"); const log = std.log.scoped(.mach); @@ -198,26 +197,6 @@ pub fn setCursorShape(_: *Darwin, _: CursorShape) void { return; } -// May be called from any thread. -pub fn joystickPresent(_: *Darwin, _: Joystick) bool { - return false; -} - -// May be called from any thread. -pub fn joystickName(_: *Darwin, _: Joystick) ?[:0]const u8 { - return null; -} - -// May be called from any thread. -pub fn joystickButtons(_: *Darwin, _: Joystick) ?[]const bool { - return null; -} - -// May be called from any thread. -pub fn joystickAxes(_: *Darwin, _: Joystick) ?[]const f32 { - return null; -} - // May be called from any thread. pub fn keyPressed(_: *Darwin, _: Key) bool { return false; diff --git a/src/core/Null.zig b/src/core/Null.zig index bb54fcdd..801d6393 100644 --- a/src/core/Null.zig +++ b/src/core/Null.zig @@ -18,7 +18,6 @@ const CursorMode = Core.CursorMode; const Position = Core.Position; const Key = Core.Key; const KeyMods = Core.KeyMods; -const Joystick = Core.Joystick; const log = std.log.scoped(.mach); @@ -115,26 +114,6 @@ pub fn setCursorShape(_: *Null, _: CursorShape) void { return; } -// May be called from any thread. -pub fn joystickPresent(_: *Null, _: Joystick) bool { - return false; -} - -// May be called from any thread. -pub fn joystickName(_: *Null, _: Joystick) ?[:0]const u8 { - return null; -} - -// May be called from any thread. -pub fn joystickButtons(_: *Null, _: Joystick) ?[]const bool { - return null; -} - -// May be called from any thread. -pub fn joystickAxes(_: *Null, _: Joystick) ?[]const f32 { - return null; -} - // May be called from any thread. pub fn keyPressed(_: *Null, _: Key) bool { return false; diff --git a/src/core/Windows.zig b/src/core/Windows.zig index d44cec09..f6c34190 100644 --- a/src/core/Windows.zig +++ b/src/core/Windows.zig @@ -17,7 +17,6 @@ const CursorMode = Core.CursorMode; const Position = Core.Position; const Key = Core.Key; const KeyMods = Core.KeyMods; -const Joystick = Core.Joystick; const EventQueue = std.fifo.LinearFifo(Event, .Dynamic); const Win32 = @This(); @@ -291,19 +290,6 @@ pub fn mousePosition(self: *Win32) Position { return self.input_state.mouse_position; } -pub fn joystickPresent(_: *Win32, _: Joystick) bool { - @panic("NOT IMPLEMENTED"); -} -pub fn joystickName(_: *Win32, _: Joystick) ?[:0]const u8 { - @panic("NOT IMPLEMENTED"); -} -pub fn joystickButtons(_: *Win32, _: Joystick) ?[]const bool { - @panic("NOT IMPLEMENTED"); -} -// May be called from any thread. -pub fn joystickAxes(_: *Win32, _: Joystick) ?[]const f32 { - @panic("NOT IMPLEMENTED"); -} pub fn nativeWindowWin32(self: *Win32) w.HWND { return self.window; }