Modules/input/Usage
From MSX Game Library
Check joystick bouton example:
u8 joyStat = Joystick_Read(JOY_PORT_1);
if (IS_JOY_PRESSED(joyStat, JOY_INPUT_TRIGGER_A))
{
// Joystick A boutton pressed
}
else if (IS_JOY_PRESSED(joyStat, JOY_INPUT_TRIGGER_B))
{
// Joystick B boutton pressed
}
Check key example:
if(Keyboard_IsKeyPressed(KEY_RETURN))
{
// "Return" key pressed
}
Quicker way to check keyboard is to read a whole keys row at once:
u8 row = Keyboard_Read(8); // The row that include the arrow keys
if(IS_KEY_PRESSED(row, KEY_RIGHT))
{
// "Right arrow" key pressed
}
else if(IS_KEY_PRESSED(row, KEY_LEFT))
{
// "Left arrow" key pressed
}