-
Notifications
You must be signed in to change notification settings - Fork 33
III. g] Hello buttons!
Buttons play a vital role in games. Without buttons games would be dull or just a video(Like many virtual reality games that do not accept user input). Lets face it, even smartphones have buttons, at least touch, and knowing how to use them would make our homebrew apps far more fun. The definitions of buttons in CTRULIB are:
KEY_A KEY_B KEY_X KEY_Y KEY_L KEY_R KEY_DUP KEY_DDOWN KEY_DRIGHT KEY_DLEFT KEY_DTOUCH(Doesn't really handles touch)
and are aways followed by:
hidScanInput(); u32 kDown = hidKeysDown(); //hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u32 kHeld = hidKeysHeld(); //hidKeysHeld returns information about which buttons have are held down in this frame u32 kUp = hidKeysUp(); //hidKeysUp returns information about which buttons have been just released
and are best used in 'if' and 'else' statements.