wxRuby Documentation Home

# Wx::JoystickEvent

This event class contains information about mouse events, particularly
events received by windows.

## Derived from

Event

## Event table macros

To process a mouse event, use these event handler macros to direct input to member
functions that take a JoystickEvent argument.

evt_joy_button_down() { | event | … } | Process a EVT_JOY_BUTTON_DOWN event.
evt_joy_button_up() { | event | … } | Process a EVT_JOY_BUTTON_UP event.
evt_joy_move() { | event | … } | Process a EVT_JOY_MOVE event.
evt_joy_zmove() { | event | … } | Process a EVT_JOY_ZMOVE event.
evt_joystick_events() { | event | … } | Processes all joystick events.

## See also

Joystick

## Methods

- JoystickEvent.new
- JoystickEvent#button_down
- JoystickEvent#button_is_down
- JoystickEvent#button_up
- JoystickEvent#get_button_change
- JoystickEvent#get_button_state
- JoystickEvent#get_joystick
- JoystickEvent#get_position
- JoystickEvent#get_zposition
- JoystickEvent#is_button
- JoystickEvent#is_move
- JoystickEvent#is_zmove

### JoystickEvent.new

JoystickEvent.new(%(arg-type)TYPE% eventType = 0, Integer state = 0, Integer joystick = JOYSTICK1, Integer change = 0)

Constructor.

### JoystickEvent#button_down

Boolean button_down(%(arg-type)Integer% button = JOY_BUTTON_ANY)

Returns true if the event was a down event from the specified button (or any button).

#### Parameters

- button Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to
  indicate any button down event.

### JoystickEvent#button_is_down

Boolean button_is_down(%(arg-type)Integer% button = JOY_BUTTON_ANY)

Returns true if the specified button (or any button) was in a down state.

#### Parameters

- button Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to
  indicate any button down event.

### JoystickEvent#button_up

Boolean button_up(%(arg-type)Integer% button = JOY_BUTTON_ANY)

Returns true if the event was an up event from the specified button (or any button).

#### Parameters

- button Can be JOY_BUTTONn where n is 1, 2, 3 or 4; or JOY_BUTTON_ANY to
  indicate any button down event.

### JoystickEvent#get_button_change

Integer get_button_change()

Returns the identifier of the button changing state. This is a JOY_BUTTONn identifier, where
n is one of 1, 2, 3, 4.

### JoystickEvent#get_button_state

Integer get_button_state()

Returns the down state of the buttons. This is a bitlist of JOY_BUTTONn identifiers, where
n is one of 1, 2, 3, 4.

### JoystickEvent#get_joystick

Integer get_joystick()

Returns the identifier of the joystick generating the event – one of JOYSTICK1 and JOYSTICK2.

### JoystickEvent#get_position

Point get_position()

Returns the x, y position of the joystick event.

### JoystickEvent#get_zposition

Integer get_zposition()

Returns the z position of the joystick event.

### JoystickEvent#is_button

Boolean is_button()

Returns true if this was a button up or down event (not ‘is any button down?’).

### JoystickEvent#is_move

Boolean is_move()

Returns true if this was an x, y move event.

### JoystickEvent#is_zmove

Boolean is_zmove()

Returns true if this was a z move event.

[This page automatically generated from the Textile source at 2023-06-09 00:45:36 +0000]