glfw: add Joystick.isPresent

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-10-21 23:06:16 -07:00 committed by Stephen Gutekanst
parent 1560e4c681
commit e7c6454f3d

View file

@ -1,4 +1,7 @@
//! Represents a Joystick or gamepad //! Represents a Joystick or gamepad
//!
//! It can be manually crafted via e.g. `glfw.Joystick{.jid = glfw.Joystick.one}`, but more
//! typically you'll want to discover the joystick using `glfw.Joystick.setCallback`.
const std = @import("std"); const std = @import("std");
@ -46,27 +49,25 @@ const GamepadState = extern struct {
axes: [6]f32, axes: [6]f32,
}; };
// TODO(joystick) /// Returns whether the specified joystick is present.
// /// Returns whether the specified joystick is present. ///
// /// /// This function returns whether the specified joystick is present.
// /// This function returns whether the specified joystick is present. ///
// /// /// There is no need to call this function before other functions that accept a joystick ID, as
// /// There is no need to call this function before other functions that accept /// they all check for presence before performing any other work.
// /// a joystick ID, as they all check for presence before performing any other ///
// /// work. /// @return `true` if the joystick is present, or `false` otherwise.
// /// ///
// /// @param[in] jid The [joystick](@ref joysticks) to query. /// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidEnum and glfw.Error.PlatformError.
// /// @return `true` if the joystick is present, or `false` otherwise. ///
// /// /// @thread_safety This function must only be called from the main thread.
// /// Possible errors include glfw.Error.NotInitialized, glfw.Error.InvalidEnum and glfw.Error.PlatformError. ///
// /// /// see also: joystick
// /// @thread_safety This function must only be called from the main thread. pub inline fn isPresent(self: Joystick) Error!bool {
// /// const is_present = c.glfwJoystickPresent(self.jid);
// /// see also: joystick try getError();
// /// Replaces `glfwGetJoystickParam`. return is_present == c.GLFW_TRUE;
// /// }
// /// @ingroup input
// GLFWAPI int glfwJoystickPresent(int jid);
// TODO(joystick) // TODO(joystick)
// /// Returns the values of all axes of the specified joystick. // /// Returns the values of all axes of the specified joystick.