Function ReadJoypad

From Uzebox Wiki
Jump to navigation Jump to search
Prototype

unsigned int ReadJoypad(unsigned char joypadNo);

Description

Read current joypad state.

Parameters
  • joypadNo
    • Controller 1 - 0b00
    • Controller 2 - 0b01
Returns

Current joypad state

Video Modes

All

Since

V2

Example:

 int buttons = ReadJoypad(0); // get the button state for controller 1 (logical 0)
 if(buttons & BTN_A){
     // do something if player presses "A"
 }

Additional information can be found in this article: Controller Event Handling.