44 lines
1.8 KiB
C
44 lines
1.8 KiB
C
// Internal input state shared between core and per-port HAL.
|
|
//
|
|
// Per-port halInputPoll() writes directly into the public state
|
|
// globals: gKeyState[] for keyboard, gMouse* for mouse, gJoy* for
|
|
// joysticks. The core compares against the matching *Prev shadow
|
|
// each joeyInputPoll to derive edge events for keys/buttons. Mouse
|
|
// position and joystick axes have no edge semantics, so no shadow.
|
|
|
|
#ifndef JOEYLIB_INPUT_INTERNAL_H
|
|
#define JOEYLIB_INPUT_INTERNAL_H
|
|
|
|
#include "joey/input.h"
|
|
#include "joey/types.h"
|
|
|
|
// Stored as uint8_t (not bool) because ORCA-C compiles _Bool as a
|
|
// 2-byte word (Symbol.pas: size := cgWordSize). The IIgs asm fast
|
|
// path (iigsInputSnapshot) walks these arrays one byte per element;
|
|
// a 2-byte bool would put element k at byte offset 2*k and the asm's
|
|
// per-byte clear would never reach the live half. uint8_t pins the
|
|
// storage to one byte per element on every port. Public predicates
|
|
// still return bool via implicit coercion.
|
|
extern uint8_t gKeyState[KEY_COUNT];
|
|
extern uint8_t gKeyPrev [KEY_COUNT];
|
|
|
|
extern int16_t gMouseX;
|
|
extern int16_t gMouseY;
|
|
extern uint8_t gMouseButtonState[MOUSE_BUTTON_COUNT];
|
|
extern uint8_t gMouseButtonPrev [MOUSE_BUTTON_COUNT];
|
|
|
|
extern uint8_t gJoyConnected[JOYSTICK_COUNT];
|
|
extern int8_t gJoyAxisX [JOYSTICK_COUNT];
|
|
extern int8_t gJoyAxisY [JOYSTICK_COUNT];
|
|
extern uint8_t gJoyButtonState[JOYSTICK_COUNT][JOY_BUTTON_COUNT];
|
|
extern uint8_t gJoyButtonPrev [JOYSTICK_COUNT][JOY_BUTTON_COUNT];
|
|
|
|
// Per-stick analog calibration. Set by joeyJoystickReset on platforms
|
|
// with analog paddles (IIgs); ignored on digital-stick platforms.
|
|
extern uint8_t gJoyDeadZone [JOYSTICK_COUNT];
|
|
|
|
// Per-port hook: called from joeyJoystickReset to clear any auto-
|
|
// disconnect state and arm a fresh center capture on the next poll.
|
|
void halJoystickReset(JoeyJoystickE js);
|
|
|
|
#endif
|