Module: GLFW::Joystick
- Defined in:
- lib/glfw/stubs/joystick.rb
Overview
Provides methods for interacting and querying joystick and gamepad peripherals.
Class Method Summary collapse
-
.axes(jid) ⇒ Array<Float>
Returns the values of all axes of the specified joystick.
-
.buttons(jid) ⇒ Array<Boolean>
Returns the state of all buttons of the specified joystick.
-
.gamepad?(jid) ⇒ Boolean
Returns whether the specified joystick is both present and has a gamepad mapping.
-
.gamepad_name(jid) ⇒ String?
Returns the human-readable name of the gamepad from the gamepad mapping assigned to the specified joystick.
-
.gamepad_state(jid) ⇒ GamepadState?
Retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
-
.guid(jid) ⇒ String?
Returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified joystick The GUID is what connects a joystick to a gamepad mapping.
-
.hats(jid) ⇒ Array<Boolean>
Returns the state of all hats of the specified joystick.
-
.name(jid) ⇒ String?
Returns the name, encoded as UTF-8, of the specified joystick.
-
.on_connection ⇒ Proc?
The previous callback that was set, or
nil
if none existed. -
.present?(jid) ⇒ Boolean
Returns whether the specified joystick is present.
-
.update_mappings(*mapping) ⇒ Integer
Parses the specified ASCII encoded string(s) and updates the internal list with any gamepad mappings it finds.
Class Method Details
.axes(jid) ⇒ Array<Float>
Returns the values of all axes of the specified joystick. Each element in the array is a value between
-1.0
and 1.0
.
84 85 |
# File 'lib/glfw/stubs/joystick.rb', line 84 def self.axes(jid) end |
.buttons(jid) ⇒ Array<Boolean>
Returns the state of all buttons of the specified joystick.
74 75 |
# File 'lib/glfw/stubs/joystick.rb', line 74 def self.(jid) end |
.gamepad?(jid) ⇒ Boolean
Returns whether the specified joystick is both present and has a gamepad mapping.
53 54 |
# File 'lib/glfw/stubs/joystick.rb', line 53 def self.gamepad?(jid) end |
.gamepad_name(jid) ⇒ String?
Returns the human-readable name of the gamepad from the gamepad mapping assigned to the specified joystick.
34 35 |
# File 'lib/glfw/stubs/joystick.rb', line 34 def self.gamepad_name(jid) end |
.gamepad_state(jid) ⇒ GamepadState?
Retrieves the state of the specified joystick remapped to an Xbox-like gamepad.
14 15 |
# File 'lib/glfw/stubs/joystick.rb', line 14 def self.gamepad_state(jid) end |
.guid(jid) ⇒ String?
Returns the SDL compatible GUID, as a UTF-8 encoded hexadecimal string, of the specified joystick 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.
64 65 |
# File 'lib/glfw/stubs/joystick.rb', line 64 def self.guid(jid) end |
.hats(jid) ⇒ Array<Boolean>
Returns the state of all hats of the specified joystick.
94 95 |
# File 'lib/glfw/stubs/joystick.rb', line 94 def self.hats(jid) end |
.name(jid) ⇒ String?
Returns the name, encoded as UTF-8, of the specified joystick.
24 25 |
# File 'lib/glfw/stubs/joystick.rb', line 24 def self.name(jid) end |
.self.on_connection {|connected| ... } ⇒ Proc? .self.on_connection ⇒ Proc?
Returns the previous callback that was set, or nil
if none existed.
122 123 |
# File 'lib/glfw/stubs/joystick.rb', line 122 def self.on_connection end |
.present?(jid) ⇒ Boolean
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.
Returns whether the specified joystick is present.
44 45 |
# File 'lib/glfw/stubs/joystick.rb', line 44 def self.present?(jid) end |
.update_mappings(*mapping) ⇒ Integer
The parser supports standard SDL gamepad mappings.
Parses the specified ASCII encoded string(s) 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.
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.
110 111 |
# File 'lib/glfw/stubs/joystick.rb', line 110 def self.update_mappings(*mapping) end |