// ***************************************************************************
// controller
// ***************************************************************************


#include <vectrex.h>



// ---------------------------------------------------------------------------
// controller initialization, each controller axis can be individually
// switched on or off; for performance reasons, activate only what you
// really need

extern void enable_controller_1_x(void);
extern void enable_controller_1_y(void);
extern void enable_controller_2_x(void);
extern void enable_controller_2_y(void);
extern void disable_controller_1_x(void);
extern void disable_controller_1_y(void);
extern void disable_controller_2_x(void);
extern void disable_controller_2_y(void);

// ---------------------------------------------------------------------------
// read controller buttons

// must be called once each time you want to check the buttons
extern void check_buttons(void);
extern uint8_t buttons_pressed(void);
extern uint8_t buttons_held(void);

// call these functions below to check if a specific button is pressed,
// the button must be released before another press is registered,
// return value is 0 or 1, so these functions can be used as check in
// conditional statements

extern uint8_t button_1_1_pressed(void);
extern uint8_t button_1_2_pressed(void);
extern uint8_t button_1_3_pressed(void);
extern uint8_t button_1_4_pressed(void);
extern uint8_t button_2_1_pressed(void);
extern uint8_t button_2_2_pressed(void);
extern uint8_t button_2_3_pressed(void);
extern uint8_t button_2_4_pressed(void);

// call these functions below to check if a specific button is held,
// return value is 0 or 1, so these functions can be used as check in
// conditional statements

extern uint8_t button_1_1_held(void);
extern uint8_t button_1_2_held(void);
extern uint8_t button_1_3_held(void);
extern uint8_t button_1_4_held(void);
extern uint8_t button_2_1_held(void);
extern uint8_t button_2_2_held(void);
extern uint8_t button_2_3_held(void);
extern uint8_t button_2_4_held(void);

// ---------------------------------------------------------------------------
// read controller joysticks

// must be called once each time you want to check the joysticks
extern void check_joysticks(void);
extern int8_t joystick_1_x(void);
extern int8_t joystick_1_y(void);
extern int8_t joystick_2_x(void);
extern int8_t joystick_2_y(void);

// call these functions below to check if a joystick is moved in
// a specific direction,
// return value is 0 or 1, so these functions can be used as check in
// conditional statements

extern int8_t joystick_1_left(void);
extern int8_t joystick_1_right(void);
extern int8_t joystick_1_down(void);
extern int8_t joystick_1_up(void);
extern int8_t joystick_2_left(void);
extern int8_t joystick_2_right(void);
extern int8_t joystick_2_down(void);
extern int8_t joystick_2_up(void);

// ***************************************************************************
// end of file
// ***************************************************************************
