Difference between revisions of "Modules/input/Usage"

From MSX Game Library

< Modules‎ | input

Line 9: Line 9:
 
{
 
{
 
// Joystick B boutton pressed
 
// Joystick B boutton pressed
 +
}
 +
</syntaxhighlight>
 +
 +
Check key example:
 +
<syntaxhighlight lang="c">
 +
if(Keyboard_IsKeyPressed(KEY_RETURN))
 +
{
 +
// "Return" key pressed
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 23:13, 7 January 2024

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
}