Jo Engine  9
Jo Sega Saturn Engine
Data Structures | Macros | Enumerations | Functions | Variables
input.h File Reference

Jo Engine Gamepad functions. More...

Go to the source code of this file.

Data Structures

struct  jo_input
 Input structure (internal engine usage) More...
 

Macros

#define JO_INPUT_MAX_DEVICE
 

Enumerations

enum  jo_gamepad_keys {
  JO_KEY_RIGHT, JO_KEY_LEFT, JO_KEY_DOWN, JO_KEY_UP,
  JO_KEY_START, JO_KEY_A, JO_KEY_B, JO_KEY_C,
  JO_KEY_X, JO_KEY_Y, JO_KEY_Z, JO_KEY_L,
  JO_KEY_R, JO_MOUSE_START_BUTTON, JO_MOUSE_LEFT_BUTTON, JO_MOUSE_MIDDLE_BUTTON,
  JO_MOUSE_RIGHT_BUTTON
}
 Input keys. More...
 
enum  jo_gamepad_type {
  JoNotConnectedGamepad, JoUnsupportedGamepad, JoRegularGamepad, JoRegularMouse,
  JoShuttleMouse
}
 Input type. More...
 

Functions

jo_gamepad_type jo_get_input_type (const int port)
 Get input type for the given port. More...
 
static __jo_force_inline bool jo_is_input_available (const int port)
 Check if the input is available for the given port. More...
 
static __jo_force_inline bool jo_is_input_key_pressed (const int port, const jo_gamepad_keys key)
 Check if the key is pressed for the given port. More...
 
static __jo_force_inline bool jo_is_input_key_down (const int port, const jo_gamepad_keys key)
 Check if the key is down for the given port. More...
 
static __jo_force_inline bool jo_is_input_key_up (const int port, const jo_gamepad_keys key)
 Check if the key is up for the given port. More...
 
static __jo_force_inline int jo_get_mouse_pos_x (const int port)
 Get mouse X position. More...
 
static __jo_force_inline int jo_get_mouse_pos_y (const int port)
 Get mouse Y position. More...
 
static __jo_force_inline bool jo_is_pad1_available (void)
 Check if the first gamepad is plugged. More...
 
static __jo_force_inline bool jo_is_pad2_available (void)
 Check if the second gamepad is plugged. More...
 
static __jo_force_inline bool jo_is_pad1_key_pressed (jo_gamepad_keys key)
 Check if the key is pressed on the first gamepad. More...
 
static __jo_force_inline bool jo_is_pad1_key_down (jo_gamepad_keys key)
 Check if the key is down on the first gamepad. More...
 
static __jo_force_inline bool jo_is_pad2_key_pressed (jo_gamepad_keys key)
 Check if the key is pressed on the second gamepad. More...
 
static __jo_force_inline bool jo_is_pad2_key_down (jo_gamepad_keys key)
 Check if the key is down on the second gamepad. More...
 

Variables

jo_input jo_inputs [(8)]
 Input status (internal engine usage) More...
 

Detailed Description

Jo Engine Gamepad functions.

Author
Johannes Fetz
Bug:
No known bugs.
Todo:
analog gamepad, wheel, gun

Data Structure Documentation

struct jo_input

Input structure (internal engine usage)

Warning
MC Hammer: don't touch this
Data Fields
unsigned char id
unsigned short on_keydown
unsigned short on_keyup
unsigned short pressed

Macro Definition Documentation

#define JO_INPUT_MAX_DEVICE

Enumeration Type Documentation

Input keys.

Enumerator
JO_KEY_RIGHT 
JO_KEY_LEFT 
JO_KEY_DOWN 
JO_KEY_UP 
JO_KEY_START 
JO_KEY_A 
JO_KEY_B 
JO_KEY_C 
JO_KEY_X 
JO_KEY_Y 
JO_KEY_Z 
JO_KEY_L 
JO_KEY_R 
JO_MOUSE_START_BUTTON 
JO_MOUSE_LEFT_BUTTON 
JO_MOUSE_MIDDLE_BUTTON 
JO_MOUSE_RIGHT_BUTTON 

Input type.

Enumerator
JoNotConnectedGamepad 
JoUnsupportedGamepad 
JoRegularGamepad 
JoRegularMouse 
JoShuttleMouse 

Function Documentation

jo_gamepad_type jo_get_input_type ( const int  port)

Get input type for the given port.

Parameters
portGamepad port
Returns
Input type (Pad, Mouse, etc)
static __jo_force_inline int jo_get_mouse_pos_x ( const int  port)
static

Get mouse X position.

Parameters
portGamepad port
Returns
X coordinate
static __jo_force_inline int jo_get_mouse_pos_y ( const int  port)
static

Get mouse Y position.

Parameters
portGamepad port
Returns
Y coordinate
static __jo_force_inline bool jo_is_input_available ( const int  port)
static

Check if the input is available for the given port.

Parameters
portGamepad port
Returns
true if the input is available otherwise false
static __jo_force_inline bool jo_is_input_key_down ( const int  port,
const jo_gamepad_keys  key 
)
static

Check if the key is down for the given port.

Parameters
portGamepad port
keyKey value
Returns
true if the key is down otherwise false
static __jo_force_inline bool jo_is_input_key_pressed ( const int  port,
const jo_gamepad_keys  key 
)
static

Check if the key is pressed for the given port.

Parameters
portGamepad port
keyKey value
Returns
true if the key is pressed otherwise false
static __jo_force_inline bool jo_is_input_key_up ( const int  port,
const jo_gamepad_keys  key 
)
static

Check if the key is up for the given port.

Parameters
portGamepad port
keyKey value
Returns
true if the key is up otherwise false
static __jo_force_inline bool jo_is_pad1_available ( void  )
static

Check if the first gamepad is plugged.

Returns
true if the first gamepad is plugged otherwise false
static __jo_force_inline bool jo_is_pad1_key_down ( jo_gamepad_keys  key)
static

Check if the key is down on the first gamepad.

Parameters
keyKey value
Returns
true if the key is down on the first gamepad otherwise false
static __jo_force_inline bool jo_is_pad1_key_pressed ( jo_gamepad_keys  key)
static

Check if the key is pressed on the first gamepad.

Parameters
keyKey value
Returns
true if the key is pressed on the first gamepad otherwise false
static __jo_force_inline bool jo_is_pad2_available ( void  )
static

Check if the second gamepad is plugged.

Returns
true if the second gamepad is plugged otherwise false
static __jo_force_inline bool jo_is_pad2_key_down ( jo_gamepad_keys  key)
static

Check if the key is down on the second gamepad.

Parameters
keyKey value
Returns
true if the key is down on the second gamepad otherwise false
static __jo_force_inline bool jo_is_pad2_key_pressed ( jo_gamepad_keys  key)
static

Check if the key is pressed on the second gamepad.

Parameters
keyKey value
Returns
true if the key is pressed on the second gamepad otherwise false

Variable Documentation

jo_input jo_inputs[(8)]

Input status (internal engine usage)

Warning
MC Hammer: don't touch this