User Tools

Site Tools


en:examples:input:keyboard_key_down

Detecting Keyboard Key Down

Handy for single presses on keys. Does not continue to trigger if the key is held down.

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_HasBeenActivated("MyKey")) {
		orxLOG("MyKey is pressed.");
	}
}
...

Config

[KeysForInput]
KEY_ESCAPE	= Quit
KEY_SPACE	= MyKey
en/examples/input/keyboard_key_down.txt · Last modified: 2026/05/23 11:00 (36 hours ago) by sausage