Class | Rubygame::Events::JoystickAxisMoved
In: | lib/rubygame/events/joystick_events.rb
Parent: | Object

JoystickAxisMoved is an event that occurs when a joystick‘s control stick has changed position on one of its axes.

A joystick axis measures the movement of the control stick. Most joysticks have at least 2 axes for each stick, one for horizontal movement, and one for vertical movement. Fancy ones have a third axis for measuring twist, and controllers with two sticks have at least 4 axes.

Unlike simple buttons or keys, which have only 2 values (pressed or not-pressed), a joystick axis has a smooth spectrum of possible values, ranging from -1.0 to 1.0. This allows for smoother, more precise control than is possible with the keyboard.

### Methods

new

### Attributes

axis | [R] |
joystick_id | [R] |
value | [R] |

### Public Class methods

new( joystick_id, axis, value )

Creates a new JoystickAxisMoved instance.

joystick_id: | an integer identifying which joystick changed. The first joystick is 0.
axis: | an integer identifying which axis changed. The first axis on each joystick is 0.
value: | a Float representing the current value of the axis. Ranges from -1.0 to 1.0.

[Validate]