joy_buttons

joy2_buttons

Binary states of all joystick buttons of the first and second joystick. Every button corresponds to a bit in this variable. The fractional part contains the bits from buttons 1..10, and the integer part contains the bits from buttons 11..32. A button state can be checked with the '&' operator.

Range:

1 = button 11 pressed.
2 = button 12 pressed.
4 = button 13 pressed.
8 = button 14 pressed.
16 = button 15 pressed, etc. ...

Type:

var, read-only

Example (lite-C):

// return nonzero when the key with the given number is pressed
function joy_pressed(var num) 
{
if (num <= 10)
return (joy_buttons<<10) & (1 << num-1);
else
return joy_buttons & (1 << num-11);
}

See also:

joy_1, joy_raw, joy2_raw, joy_rot , joy2_rot, joy_force, num_joysticks, keys.c

► latest version online