Class: Rubygame::JoyHatEvent
Overview
Indicates that a Joystick POV hat was moved.
This event has these attributes:
- joynum
-
the identifier number of the affected Joystick.
- hat
-
the identifier number of the hat.
- value
-
the new direction of the hat, one of these constants in module Rubygame (or the corresponding number):
- HAT_CENTERED
-
0
- HAT_UP
-
1
- HAT_RIGHT
-
2
- HAT_DOWN
-
4
- HAT_LEFT
-
8
- HAT_RIGHTUP
-
3
- HAT_RIGHTDOWN
-
6
- HAT_LEFTUP
-
9
- HAT_LEFTDOWN
-
12
Instance Attribute Summary collapse
-
#hat ⇒ Object
Returns the value of attribute hat.
-
#joynum ⇒ Object
Returns the value of attribute joynum.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(joy, hat, value) ⇒ JoyHatEvent
constructor
A new instance of JoyHatEvent.
Constructor Details
#initialize(joy, hat, value) ⇒ JoyHatEvent
Returns a new instance of JoyHatEvent.
362 363 364 365 366 367 |
# File 'lib/rubygame/event.rb', line 362 def initialize(joy,hat,value) # eventually, joy could be int OR a Rubygame::Joystick instance, # which would be stored as joy or maybe joyinstance? @joynum = joy @hat, @value = hat, value end |
Instance Attribute Details
#hat ⇒ Object
Returns the value of attribute hat.
361 362 363 |
# File 'lib/rubygame/event.rb', line 361 def hat @hat end |
#joynum ⇒ Object
Returns the value of attribute joynum.
361 362 363 |
# File 'lib/rubygame/event.rb', line 361 def joynum @joynum end |
#value ⇒ Object
Returns the value of attribute value.
361 362 363 |
# File 'lib/rubygame/event.rb', line 361 def value @value end |