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

JoystickHatMoved is an event that occurs when a joystick‘s hat switch has changed direction.

A joystick hat switch is a round switch that can be pressed in 8 possible directions: up, down, left, right, or the four diagonal directions. (Some hat switches support extra diagonal directions, but only those 8 directions are supported by Rubygame.)

Methods

center?   center?   down?   down?   left?   left?   new   new   right?   right?   up?   up?  

Attributes

direction  [R] 
direction  [R] 
hat  [R] 
hat  [R] 
horizontal  [R] 
horizontal  [R] 
joystick_id  [R] 
joystick_id  [R] 
vertical  [R] 
vertical  [R] 

Public Class methods

Creates a new JoystickHatMoved instance.

joystick_id:an integer identifying which joystick changed. The first joystick is 0.
hat:an integer identifying which hat switch changed. The first hat switch on each joystick is 0.
direction:a symbol telling the direction the hat switch is being pressed. The direction is either nil or one of these 8 symbols:

:up :up_right :right :down_right :down :down_left :left :up_left

Creates a new JoystickHatMoved instance.

joystick_id:an integer identifying which joystick changed. The first joystick is 0.
hat:an integer identifying which hat switch changed. The first hat switch on each joystick is 0.
direction:a symbol telling the direction the hat switch is being pressed. The direction is either nil or one of these 8 symbols:

:up :up_right :right :down_right :down :down_left :left :up_left

Public Instance methods

True if the hat is in the center (not pressed in any direction).

True if the hat is in the center (not pressed in any direction).

True if the hat is pressed down, down-right, or down-left.

True if the hat is pressed down, down-right, or down-left.

True if the hat is pressed left, up-left, or down-left.

True if the hat is pressed left, up-left, or down-left.

True if the hat is pressed right, up-right, or down-right.

True if the hat is pressed right, up-right, or down-right.

True if the hat is pressed up, up-right, or up-left.

True if the hat is pressed up, up-right, or up-left.

[Validate]