User Tools

Site Tools


en:examples:input:keyboard_input

Keyboard Inputs

Code

orxSTATUS orxFASTCALL Init()
{
  orxClock_Register(orxClock_Get(orxCLOCK_KZ_CORE), Update, orxNULL, orxMODULE_ID_MAIN, orxCLOCK_PRIORITY_NORMAL);
...

void orxFASTCALL Update(const orxCLOCK_INFO *_pstClockInfo, void *_pContext)
{
	if (orxInput_IsActive("GoLeft")) {
		orxLOG("Left Key Pressed.");
	}
	if (orxInput_IsActive("GoRight")) {
		orxLOG("Right Key Pressed.");
	}
	if (orxInput_IsActive("GoUp")) {
		orxLOG("Up Key Pressed.");
	}
	if (orxInput_IsActive("GoDown")) {
		orxLOG("Down Key Pressed.");
	}
}
...

Config

[KeysForInput]
KEY_ESCAPE	= Quit
KEY_UP		= GoUp
KEY_DOWN	= GoDown
KEY_LEFT	= GoLeft
KEY_RIGHT	= GoRight

en/examples/input/keyboard_input.txt · Last modified: 2022/12/06 13:40 (16 months ago) by iarwain