Single controller input display. More...
Functions | |
| int | main (void) |
| Entry point — gameLoopRun never returns. | |
| static void | on_init (void) |
| One-time setup. Static labels then screen on. | |
| static void | on_update (void) |
| Per-frame: read joypad, paint the held button name. | |
Single controller input display.
Reads the SNES controller and displays which button is currently held. The simplest possible input example — one controller, one text line, real-time feedback. This is the starting point for understanding how SNES games read player input.
The SNES joypad has 12 buttons: 4 face buttons (A, B, X, Y), 2 shoulder buttons (L, R), a D-pad (4 directions), START, and SELECT. The NMI handler reads the joypad automatically every VBlank. Your code just calls padHeld(0) to get the current state as a 16-bit bitmask.
Ported from PVSnesLib "controller" example by alekmaul.
| int main | ( | void | ) |
Entry point — gameLoopRun never returns.
|
static |
One-time setup. Static labels then screen on.
|
static |
Per-frame: read joypad, paint the held button name.
padHeld() returns the bitmask of currently-pressed buttons (latched by the NMI handler this frame). The if/else cascade prints the first match — multiple-button combinations only show one.