Class: Rubygame::JoyHatEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/rubygame/event.rb

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

Instance Method Summary collapse

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

#hatObject

Returns the value of attribute hat.



361
362
363
# File 'lib/rubygame/event.rb', line 361

def hat
  @hat
end

#joynumObject

Returns the value of attribute joynum.



361
362
363
# File 'lib/rubygame/event.rb', line 361

def joynum
  @joynum
end

#valueObject

Returns the value of attribute value.



361
362
363
# File 'lib/rubygame/event.rb', line 361

def value
  @value
end