//
// Generated by Brutal.Glfw.Generate; do not edit by hand.
#nullable enable
namespace Brutal.GlfwApi
{
public static unsafe partial class Glfw
{
///
/// Returns whether raw mouse motion is supported.
///
///
/// This function returns whether raw mouse motion is supported on the current system. This status does not
/// change after GLFW has been initialized so you only need to check this once. If you attempt to enable raw
/// motion on a system that does not support it, a will be emitted.
///
/// Raw mouse motion is closer to the actual motion of the mouse across a surface. It is not affected by the
/// scaling and acceleration applied to the motion of the desktop cursor. That processing is suitable for a
/// cursor while raw motion is better for controlling for example a 3D camera. Because of this, raw mouse
/// motion is only provided when the cursor is disabled.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
/// GlfwWindow.SetInputMode
/// Raw mouse
/// motion
public static bool RawMotionSupported() => PInvoke.RawMouseMotionSupported() == GLFW_TRUE;
///
/// Returns the layout-specific name of the specified printable key.
///
/// The key to query, or .
/// The scancode of the key to query.
/// The layout-specific name of the specified key, or null if the key is non-printable.
///
/// This function returns the name of the specified printable key, encoded as UTF-8. This is typically the
/// character that key would produce without any modifier keys, intended for displaying key bindings to the
/// user. For dead keys, it is typically the diacritic it would add to a character.
///
/// Do not use this function for
/// text input. You will
/// break text input for many languages even if it happens to work for yours.
///
///
/// If the key is , the scancode is used to identify the key, otherwise the
/// scancode is ignored. If you specify a non-printable key, or and a scancode
/// that maps to a non-printable key, this function returns null but does not emit an error.
///
///
/// This behavior allows you to always pass in the arguments in the
/// key callback without
/// modification.
///
///
/// Names for printable keys depend on a keyboard layout, while names for non-printable keys are the same
/// across layouts but depend on the application language and should be localized along with other user
/// interface text.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Key names
public static string? GetKeyName(GlfwKey key, int scanCode) => PInvoke.GetKeyName((int)key, scanCode);
///
/// Returns the platform-specific scancode of the specified key.
///
/// Any key token.
/// The platform-specific scancode of the specified key, or -1 if the key is not
/// supported on the current platform or an error occurred.
///
/// This function returns the platform-specified scancode of the specified key.
///
/// If the specified key token
/// corresponds to a physical key not supported on the current platform then this method will return
/// -1. Calling this function with anything other than a key token will return -1. and
/// generate a error.
///
///
///
/// This function may be called from any thread.
///
///
///
///
/// Key input
public static int GetKeyScanCode(int key) => PInvoke.GetKeyScanCode(key);
///
/// Returns whether the specified joystick is present.
///
/// The joystick ID to query.
///
/// 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 they all
/// check for presence before performing any other work.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Joystick input
public static bool JoystickPresent(int joystickId) => PInvoke.JoystickPresent(joystickId) == GLFW_TRUE;
///
/// Returns the values of all axes of the specified joystick.
///
/// The joystick ID to query.
/// An array of axis values, or null if the joystick is not present or an error
/// occurred.
///
/// This function returns the values of all axes of the specified joystick. Each element in the array is a
/// value between -1.0 and 1.0.
///
/// If the specified joystick is not present this function will return null but will not generate an
/// error. This can be used instead of first calling
/// Glfw.JoystickPresent.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Joystick axis
/// states
public static ReadOnlySpan GetJoystickAxes(int joystickId)
{
int count;
return new ReadOnlySpan(PInvoke.GetJoystickAxes(joystickId, out count), count);
}
///
/// Returns the state of all buttons of the specified joystick.
///
/// The joystick ID to query.
/// An array of button states, or null if the joystick is not present or an error
/// occurred.
///
/// This function returns the state of all buttons of the specified joystick. Each element in the array is
/// either or .
///
/// For backward compatibility with earlier versions that did not have , the
/// button array also includes all hats, each represented as four buttons. The hats are in the same order as
/// returned by GetJoystickHats and are in the order up, right, down and
/// left. To disable these extra buttons, set the
/// init hint before initialization.
///
///
/// If the specified joystick is not present this function will return null but will not generate an
/// error. This can be used instead of first calling
/// Glfw.JoystickPresent.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Joystick button
/// states
public static ReadOnlySpan GetJoystickButtons(int joystickId)
{
int count;
return new ReadOnlySpan(PInvoke.GetJoystickButtons(joystickId, out count), count);
}
///
/// Returns the name of the specified joystick.
///
/// The joystick ID to query.
/// The name of the joystick, or null if the joystick is not present or an error occurred.
///
/// This function returns the name, encoded as UTF-8, of the specified joystick. The returned string is
/// allocated and freed by GLFW. You should not free it yourself.
///
/// If the specified joystick is not present this function will return null but will not generate an
/// error. This can be used instead of first calling
/// Glfw.JoystickPresent.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Joystick name
public static string? GetJoystickName(int joystickId) => PInvoke.GetJoystickName(joystickId);
///
/// Returns the SDL compatible GUID of the specified joystick.
///
/// The joystick ID to query.
/// The GUID of the joystick, or null if the joystick is not present or an error occurred.
///
/// This function returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified
/// joystick. The returned string is allocated and freed by GLFW. You should not free it yourself.
///
/// The GUID is what connects a joystick to a gamepad mapping. A connected joystick will always have a GUID
/// even if there is no gamepad mapping assigned to it.
///
///
/// If the specified joystick is not present this function will return null but will not generate an error.
/// This can be used instead of first calling Glfw.JoystickPresent.
///
///
/// The GUID uses the format introduced in SDL 2.0.5. This GUID tries to uniquely identify the make and
/// model of a joystick but does not identify a specific unit, e.g. all wired Xbox 360 controllers will have
/// the same GUID on that platform. The GUID for a unit may vary between platforms depending on what
/// hardware information the platform specific APIs provide.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Gamepad input
public static string? GetJoystickGuid(int joystickId) => PInvoke.GetJoystickGuid(joystickId);
///
/// Sets the user pointer of the specified joystick.
///
/// The joystick whose user pointer to set.
/// The new user pointer value.
///
/// This function sets the user-defined pointer of the specified joystick. The current value is retained until
/// the joystick is disconnected. The initial value is null.
///
/// This function may be called from the joystick callback, even for a joystick that is being disconnected.
///
///
///
/// This function may be called from any thread. Access is not synchronized.
///
///
///
///
/// GetJoystickUserPointer
/// Joystick user
/// pointer
public static void SetJoystickUserPointer(int joystickId, void* handle) =>
PInvoke.SetJoystickUserPointer(joystickId, handle);
///
/// Returns the user pointer of the specified joystick.
///
/// The joystick whose user pointer to return.
///
/// This function returns the current value of the user-defined pointer of the specified joystick. The initial
/// value is null.
///
/// This function may be called from the joystick callback, even for a joystick that is being disconnected.
///
///
///
/// This function may be called from any thread. Access is not synchronized.
///
///
///
///
/// SetJoystickUserPointer
/// Joystick user
/// pointer
public static void* GetJoystickUserPointer(int joystickId) => PInvoke.GetJoystickUserPointer(joystickId);
///
/// Returns whether the specified joystick has a gamepad mapping
///
/// The joystick ID to query.
/// true if the joystick is both present and has a gamepad mapping, otherwise
/// false.
///
/// This function returns whether the specified joystick is both present and has a gamepad mapping.
///
/// If the specified joystick is present but does not have a gamepad mapping this function will return
/// false but will not generate an error. Call
/// Glfw.JoystickPresent to check if a joystick is present regardless
/// of whether it has a mapping.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Gamepad input
public static bool JoystickIsGamepad(int joystickId) => PInvoke.JoystickIsGamepad(joystickId) == GLFW_TRUE;
///
/// Adds the specified SDL_GameControllerDB gamepad mappings
///
/// The string containing the gamepad mappings.
/// true if successful, or false if an error occurred.
///
/// This function parses the specified ASCII encoded string and updates the internal list with any gamepad
/// mappings it finds. This string may contain either a single gamepad mapping or many mappings separated by
/// newlines. The parser supports the full format of the gamecontrollerdb.txt source file including
/// empty lines and comments.
///
/// See Gamepad mappings
/// for a description of the format.
///
///
/// If there is already a gamepad mapping for a given GUID in the internal list, it will be replaced by the
/// one passed to this function. If the library is terminated and re-initialized the internal list will
/// revert to the built-in default.
///
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
///
/// Gamepad input
public static bool UpdateGamepadMappings(string mappings) =>
PInvoke.UpdateGamepadMappings(mappings) == GLFW_TRUE;
///
/// Returns the human-readable gamepad name for the specified joystick.
///
/// The joystick ID to query.
/// The name of the gamepad, or null if the joystick is not present, or does not have a
/// gamepad mapping or an error occurred.
///
/// This function returns the human-readable name of the gamepad from the gamepad mapping assigned to the
/// specified joystick. If the specified joystick is not present or does not have a gamepad mapping this
/// function will return null but will not generate an error. Call to check
/// whether it is present regardless of whether it has a mapping.
///
///
/// This function must only be called from the main thread.
///
///
///
///
///
/// Gamepad input
public static string? GetGamepadName(int gamepadId) => PInvoke.GetGamepadName(gamepadId);
///
/// Retrieves the state of the specified joystick remapped as a gamepad.
///
/// The joystick ID to query.
/// The gamepad state to fill.
/// true if successful, or false if the joystick is not present, it does not
/// have a gamepad mapping or an error occurred.
///
/// This function retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
///
/// If the specified joystick is not present or does not have a gamepad mapping this function will return
/// false but will not generate an error. Call to check whether it is
/// present regardless of whether it has a mapping.
///
///
/// The Guide button may not be available for input as it is often hooked by the system or the Steam client.
///
///
/// Not all devices have all the buttons or axes provided by . Unavailable
/// buttons and axes will always report and 0.0 respectively.
///
///
///
///
///
///
///
/// Gamepad input
public static bool GetGamepadState(int gamepadId, out GlfwGamepadState state)
{
state = default;
return PInvoke.GetGamepadState(gamepadId, out state) == GLFW_TRUE;
}
///
/// Sets the GLFW time.
///
///
/// This function sets the current GLFW time, in seconds. The value must be a positive finite number less than
/// or equal to 18446744073.0, which is approximately 584.5 years.
///
/// This function and are helper functions on top of and
/// .
///
///
///
/// This function may be called from any thread. Reading and writing of the internal base time is not atomic,
/// so it needs to be externally synchronized with calls to .
///
///
///
///
/// Time input
public static void SetTime(double time) => PInvoke.SetTime(time);
///
/// Returns the current value of the raw timer.
///
/// The value of the timer, or zero if an error occurred.
///
/// This function returns the current value of the raw timer, measured in 1 / frequency seconds. To get the
/// frequency, call .
///
///
/// This function may be called from any thread.
///
///
///
///
/// Time input
public static ulong GetTimerValue() => PInvoke.GetTimerValue();
///
/// Returns the frequency, in Hz, of the raw timer.
///
/// The frequency of the timer, in Hz, or zero if an error occurred.
///
/// This function returns the frequency, in Hz, of the raw timer.
///
///
/// This function may be called from any thread.
///
///
///
///
///
/// Time input
public static ulong GetTimerFrequency() => PInvoke.GetTimerFrequency();
}
}