SNES Controller Input. More...
#include <snes/types.h>Go to the source code of this file.
Macros | |
| #define | KEY_A BIT(7) |
| #define | KEY_B BIT(15) |
| #define | KEY_DOWN BIT(10) |
| #define | KEY_DPAD (KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT) |
| All D-pad directions. | |
| #define | KEY_FACE (KEY_A | KEY_B | KEY_X | KEY_Y) |
| All face buttons. | |
| #define | KEY_L BIT(5) |
| #define | KEY_LEFT BIT(9) |
| #define | KEY_R BIT(4) |
| #define | KEY_RIGHT BIT(8) |
| #define | KEY_SELECT BIT(13) |
| #define | KEY_START BIT(12) |
| #define | KEY_UP BIT(11) |
| #define | KEY_X BIT(6) |
| #define | KEY_Y BIT(14) |
| #define | MOUSE_BUTTON_LEFT 0x01 |
| #define | MOUSE_BUTTON_RIGHT 0x02 |
| #define | MOUSE_SENS_HIGH 2 |
| #define | MOUSE_SENS_LOW 0 |
| #define | MOUSE_SENS_MEDIUM 1 |
| #define | SSC_CURSOR 0x4000 |
| #define | SSC_FIRE 0x8000 |
| #define | SSC_NOISE 0x0100 |
| #define | SSC_OFFSCREEN 0x0200 |
| #define | SSC_PAUSE 0x1000 |
| #define | SSC_TURBO 0x2000 |
Functions | |
| u8 | mouseButtonsHeld (u8 port) |
| Get currently held mouse buttons. | |
| u8 | mouseButtonsPressed (u8 port) |
| Get newly pressed mouse buttons this frame. | |
| u8 | mouseGetSensitivity (u8 port) |
| Get current mouse sensitivity. | |
| s16 | mouseGetX (u8 port) |
| Get X displacement since last frame. | |
| s16 | mouseGetY (u8 port) |
| Get Y displacement since last frame. | |
| u8 | mouseInit (u8 port) |
| Initialize mouse on given port. | |
| u8 | mouseIsConnected (u8 port) |
| Check if mouse is connected on port. | |
| void | mouseSetSensitivity (u8 port, u8 sensitivity) |
| Set mouse sensitivity. | |
| u16 | padHeld (u8 pad) |
| Get buttons currently held. | |
| u8 | padIsConnected (u8 pad) |
| Check if controller is connected. | |
| u16 | padPressed (u8 pad) |
| Get buttons pressed this frame. | |
| u16 | padRaw (u8 pad) |
| Get raw button state. | |
| u16 | padReleased (u8 pad) |
| Get buttons released this frame. | |
| u16 | scopeButtonsDown (void) |
| Get currently held buttons. | |
| u16 | scopeButtonsHeld (void) |
| Get buttons held past the hold delay threshold. | |
| u16 | scopeButtonsPressed (void) |
| Get newly pressed buttons this frame. | |
| void | scopeCalibrate (void) |
| Calibrate aim from a center-screen shot. | |
| u16 | scopeGetRawX (void) |
| Get raw (uncalibrated) H position from PPU. | |
| u16 | scopeGetRawY (void) |
| Get raw (uncalibrated) V position from PPU. | |
| u16 | scopeGetX (void) |
| Get calibration-adjusted H position. | |
| u16 | scopeGetY (void) |
| Get calibration-adjusted V position. | |
| u8 | scopeInit (void) |
| Detect Super Scope on port 2. | |
| u8 | scopeIsConnected (void) |
| Check if Super Scope is connected. | |
| void | scopeSetHoldDelay (u16 frames) |
| Set hold delay (frames before hold triggers). | |
| void | scopeSetRepeatDelay (u16 frames) |
| Set repeat delay (frames between repeat fires after hold). | |
| u16 | scopeSinceShot (void) |
| Get frames since last detected shot. | |
SNES Controller Input.
Functions for reading controller input.
Use these constants with padPressed(), padHeld(), etc:
| Constant | Button |
|---|---|
| KEY_A | A button |
| KEY_B | B button |
| KEY_X | X button |
| KEY_Y | Y button |
| KEY_L | L shoulder |
| KEY_R | R shoulder |
| KEY_START | Start |
| KEY_SELECT | Select |
| KEY_UP | D-pad up |
| KEY_DOWN | D-pad down |
| KEY_LEFT | D-pad left |
| KEY_RIGHT | D-pad right |
Check if controller is connected.
| pad | Controller number (0-3) |
Get buttons pressed this frame.
Returns buttons that were just pressed (not held from previous frame).
| pad | Controller number (0-3) |
Get raw button state.
Returns the raw hardware state without edge detection.
| pad | Controller number (0-3) |