User Tools

Site Tools


en:examples:input:keyboard_input

Keyboard Inputs

Code

orxSTATUS orxFASTCALL Init()
{
  orxClock_Register(orxClock_FindFirst(orx2F(-1.0f), orxCLOCK_TYPE_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: 2018/02/14 08:47 (24 months ago) (external edit)