wxRuby Documentation Home

# Wx::Joystick

Joystick allows an application to control one or more joysticks.

## Derived from

Object

## See also

JoystickEvent

## Methods

- Joystick.new
- Joystick#get_button_state
- Joystick#get_manufacturer_id
- Joystick#get_movement_threshold
- Joystick#get_number_axes
- Joystick#get_number_buttons
- Joystick#get_number_joysticks
- Joystick#get_polling_max
- Joystick#get_polling_min
- Joystick#get_product_id
- Joystick#get_product_name
- Joystick#get_position
- Joystick#get_pov_position
- Joystick#get_povcts_position
- Joystick#get_rudder_max
- Joystick#get_rudder_min
- Joystick#get_rudder_position
- Joystick#get_umax
- Joystick#get_umin
- Joystick#get_uposition
- Joystick#get_vmax
- Joystick#get_vmin
- Joystick#get_vposition
- Joystick#get_xmax
- Joystick#get_xmin
- Joystick#get_ymax
- Joystick#get_ymin
- Joystick#get_zmax
- Joystick#get_zmin
- Joystick#get_zposition
- Joystick#has_pov
- Joystick#has_pov4__dir
- Joystick#has_povcts
- Joystick#has_rudder
- Joystick#has_u
- Joystick#has_v
- Joystick#has_z
- Joystick#is_ok
- Joystick#release_capture
- Joystick#set_capture
- Joystick#set_movement_threshold

### Joystick.new

Joystick.new(%(arg-type)Integer% joystick = JOYSTICK1)

Constructor. joystick may be one of JOYSTICK1, JOYSTICK2, indicating the joystick
controller of interest.

destructor()

Destroys the Joystick object.

### Joystick#get_button_state

Integer get_button_state()

Returns the state of the joystick buttons. Every button is mapped to a single
bit in the returned integer, with the first button being mapped to the least
significant bit, and so on.
A bitlist of JOY_BUTTONn identifiers, where n is 1, 2, 3 or 4
is available for historical reasons.

### Joystick#get_manufacturer_id

Integer get_manufacturer_id()

Returns the manufacturer id.

### Joystick#get_movement_threshold

Integer get_movement_threshold()

Returns the movement threshold, the number of steps outside which the joystick is deemed to have
moved.

### Joystick#get_number_axes

Integer get_number_axes()

Returns the number of axes for this joystick.

### Joystick#get_number_buttons

Integer get_number_buttons()

Returns the number of buttons for this joystick.

### Joystick#get_number_joysticks

Integer get_number_joysticks()

Returns the number of joysticks currently attached to the computer.

### Joystick#get_polling_max

Integer get_polling_max()

Returns the maximum polling frequency.

### Joystick#get_polling_min

Integer get_polling_min()

Returns the minimum polling frequency.

### Joystick#get_product_id

Integer get_product_id()

Returns the product id for the joystick.

### Joystick#get_product_name

String get_product_name()

Returns the product name for the joystick.

### Joystick#get_position

Point get_position()

Returns the x, y position of the joystick.

### Joystick#get_pov_position

Integer get_pov_position()

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units,
but limited to return 0, 9000, 18000 or 27000.
Returns -1 on error.

### Joystick#get_povcts_position

Integer get_povcts_position()

Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units.
Returns -1 on error.

### Joystick#get_rudder_max

Integer get_rudder_max()

Returns the maximum rudder position.

### Joystick#get_rudder_min

Integer get_rudder_min()

Returns the minimum rudder position.

### Joystick#get_rudder_position

Integer get_rudder_position()

Returns the rudder position.

### Joystick#get_umax

Integer get_umax()

Returns the maximum U position.

### Joystick#get_umin

Integer get_umin()

Returns the minimum U position.

### Joystick#get_uposition

Integer get_uposition()

Gets the position of the fifth axis of the joystick, if it exists.

### Joystick#get_vmax

Integer get_vmax()

Returns the maximum V position.

### Joystick#get_vmin

Integer get_vmin()

Returns the minimum V position.

### Joystick#get_vposition

Integer get_vposition()

Gets the position of the sixth axis of the joystick, if it exists.

### Joystick#get_xmax

Integer get_xmax()

Returns the maximum x position.

### Joystick#get_xmin

Integer get_xmin()

Returns the minimum x position.

### Joystick#get_ymax

Integer get_ymax()

Returns the maximum y position.

### Joystick#get_ymin

Integer get_ymin()

Returns the minimum y position.

### Joystick#get_zmax

Integer get_zmax()

Returns the maximum z position.

### Joystick#get_zmin

Integer get_zmin()

Returns the minimum z position.

### Joystick#get_zposition

Integer get_zposition()

Returns the z position of the joystick.

### Joystick#has_pov

Boolean has_pov()

Returns true if the joystick has a point of view control.

### Joystick#has_pov4__dir

Boolean has_pov4__dir()

Returns true if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right).

### Joystick#has_povcts

Boolean has_povcts()

Returns true if the joystick point-of-view supports continuous degree bearings.

### Joystick#has_rudder

Boolean has_rudder()

Returns true if there is a rudder attached to the computer.

### Joystick#has_u

Boolean has_u()

Returns true if the joystick has a U axis.

### Joystick#has_v

Boolean has_v()

Returns true if the joystick has a V axis.

### Joystick#has_z

Boolean has_z()

Returns true if the joystick has a Z axis.

### Joystick#is_ok

Boolean is_ok()

Returns true if the joystick is functioning.

### Joystick#release_capture

Boolean release_capture()

Releases the capture set by SetCapture.

#### Return value

true if the capture release succeeded.

#### See also

Joystick#set_capture, JoystickEvent

### Joystick#set_capture

Boolean set_capture(%(arg-type)Window% win, Integer pollingFreq = 0)

Sets the capture to direct joystick events to win.

#### Parameters

- win The window that will receive joystick events.
- pollingFreq If zero, movement events are sent when above the
  threshold. If greater than zero, events are received every pollingFreq milliseconds.

#### Return value

true if the capture succeeded.

#### See also

Joystick#release_capture, JoystickEvent

### Joystick#set_movement_threshold

set_movement_threshold(%(arg-type)Integer% threshold)

Sets the movement threshold, the number of steps outside which the joystick is deemed to have
moved.

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