core: remove unimplemented joystick API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
19afd254b9
commit
1fab277bf7
4 changed files with 0 additions and 107 deletions
51
src/Core.zig
51
src/Core.zig
|
|
@ -429,8 +429,6 @@ pub const Event = union(enum) {
|
||||||
xoffset: f32,
|
xoffset: f32,
|
||||||
yoffset: f32,
|
yoffset: f32,
|
||||||
},
|
},
|
||||||
joystick_connected: Joystick,
|
|
||||||
joystick_disconnected: Joystick,
|
|
||||||
framebuffer_resize: Size,
|
framebuffer_resize: Size,
|
||||||
focus_gained,
|
focus_gained,
|
||||||
focus_lost,
|
focus_lost,
|
||||||
|
|
@ -604,10 +602,6 @@ pub const KeyMods = packed struct(u8) {
|
||||||
_padding: u2 = 0,
|
_padding: u2 = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Joystick = enum(u8) {
|
|
||||||
zero,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub inline fn pollEvents(core: *@This()) EventIterator {
|
pub inline fn pollEvents(core: *@This()) EventIterator {
|
||||||
return .{ .platform = core.platform.pollEvents() };
|
return .{ .platform = core.platform.pollEvents() };
|
||||||
}
|
}
|
||||||
|
|
@ -779,45 +773,6 @@ pub inline fn cursorShape(core: *@This()) CursorShape {
|
||||||
return core.platform.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 {
|
pub inline fn keyPressed(core: *@This(), key: Key) bool {
|
||||||
return core.platform.keyPressed(key);
|
return core.platform.keyPressed(key);
|
||||||
}
|
}
|
||||||
|
|
@ -1133,11 +1088,6 @@ comptime {
|
||||||
assertHasDecl(Platform, "setCursorShape");
|
assertHasDecl(Platform, "setCursorShape");
|
||||||
assertHasField(Platform, "cursor_shape");
|
assertHasField(Platform, "cursor_shape");
|
||||||
|
|
||||||
assertHasDecl(Platform, "joystickPresent");
|
|
||||||
assertHasDecl(Platform, "joystickName");
|
|
||||||
assertHasDecl(Platform, "joystickButtons");
|
|
||||||
assertHasDecl(Platform, "joystickAxes");
|
|
||||||
|
|
||||||
assertHasDecl(Platform, "keyPressed");
|
assertHasDecl(Platform, "keyPressed");
|
||||||
assertHasDecl(Platform, "keyReleased");
|
assertHasDecl(Platform, "keyReleased");
|
||||||
assertHasDecl(Platform, "mousePressed");
|
assertHasDecl(Platform, "mousePressed");
|
||||||
|
|
@ -1170,5 +1120,4 @@ test {
|
||||||
@import("std").testing.refAllDeclsRecursive(DisplayMode);
|
@import("std").testing.refAllDeclsRecursive(DisplayMode);
|
||||||
@import("std").testing.refAllDeclsRecursive(CursorMode);
|
@import("std").testing.refAllDeclsRecursive(CursorMode);
|
||||||
@import("std").testing.refAllDeclsRecursive(CursorShape);
|
@import("std").testing.refAllDeclsRecursive(CursorShape);
|
||||||
@import("std").testing.refAllDeclsRecursive(Joystick);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ const CursorMode = Core.CursorMode;
|
||||||
const Position = Core.Position;
|
const Position = Core.Position;
|
||||||
const Key = Core.Key;
|
const Key = Core.Key;
|
||||||
const KeyMods = Core.KeyMods;
|
const KeyMods = Core.KeyMods;
|
||||||
const Joystick = Core.Joystick;
|
|
||||||
const objc = @import("objc");
|
const objc = @import("objc");
|
||||||
|
|
||||||
const log = std.log.scoped(.mach);
|
const log = std.log.scoped(.mach);
|
||||||
|
|
@ -198,26 +197,6 @@ pub fn setCursorShape(_: *Darwin, _: CursorShape) void {
|
||||||
return;
|
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.
|
// May be called from any thread.
|
||||||
pub fn keyPressed(_: *Darwin, _: Key) bool {
|
pub fn keyPressed(_: *Darwin, _: Key) bool {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ const CursorMode = Core.CursorMode;
|
||||||
const Position = Core.Position;
|
const Position = Core.Position;
|
||||||
const Key = Core.Key;
|
const Key = Core.Key;
|
||||||
const KeyMods = Core.KeyMods;
|
const KeyMods = Core.KeyMods;
|
||||||
const Joystick = Core.Joystick;
|
|
||||||
|
|
||||||
const log = std.log.scoped(.mach);
|
const log = std.log.scoped(.mach);
|
||||||
|
|
||||||
|
|
@ -115,26 +114,6 @@ pub fn setCursorShape(_: *Null, _: CursorShape) void {
|
||||||
return;
|
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.
|
// May be called from any thread.
|
||||||
pub fn keyPressed(_: *Null, _: Key) bool {
|
pub fn keyPressed(_: *Null, _: Key) bool {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ const CursorMode = Core.CursorMode;
|
||||||
const Position = Core.Position;
|
const Position = Core.Position;
|
||||||
const Key = Core.Key;
|
const Key = Core.Key;
|
||||||
const KeyMods = Core.KeyMods;
|
const KeyMods = Core.KeyMods;
|
||||||
const Joystick = Core.Joystick;
|
|
||||||
|
|
||||||
const EventQueue = std.fifo.LinearFifo(Event, .Dynamic);
|
const EventQueue = std.fifo.LinearFifo(Event, .Dynamic);
|
||||||
const Win32 = @This();
|
const Win32 = @This();
|
||||||
|
|
@ -291,19 +290,6 @@ pub fn mousePosition(self: *Win32) Position {
|
||||||
return self.input_state.mouse_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 {
|
pub fn nativeWindowWin32(self: *Win32) w.HWND {
|
||||||
return self.window;
|
return self.window;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue