/* * ============================================================ * FILE: controls.h * * PURPOSE: Defines `Input`, the one abstract snapshot of what the player * is asking for this tick. Gameplay code reads Input and never * reads a raw device, so the player and camera don't care whether * a gamepad or the keyboard produced it. * * FITS IN: main.c calls controls_poll() once per fixed tick and passes the * Input to player_update() and camera_update(). * * INTERFACE: Use these exact names: * * typedef struct Input { * Vec2 move; left stick after the deadzone. Length is 0..1. * +x = right, +y = FORWARD (stick pushed up). * Vec2 look; right stick after the deadzone. Length is 0..1. * +x = orbit camera right, +y = tilt camera up. * bool jump_held; A is down this tick * bool jump_pressed; A went down THIS tick (true for one tick only) * bool reset_pressed; Back/Select went down this tick (one tick only) * bool quit_pressed; Start (or Esc) went down this tick (one tick only) * bool using_gamepad; true if a gamepad produced this Input (debug info) * } Input; * * void controls_init(void); call after window_init() * void controls_poll(Input *out); call once per FIXED TICK (not once per * frame). The "pressed" edges are * worked out tick-to-tick, so a press * is never lost or counted twice. * * Include and "math3d.h" (for Vec2). * * CONVENTIONS: Include guard: CONTROLS_H. * * NOT IN SCOPE: Rebinding, multiple players, mouse look, rumble. * * DONE WHEN: player.c and camera.c can be written against Input alone, * without including GLFW. * ============================================================ */ #ifndef CONTROLS_H #define CONTROLS_H #endif /* CONTROLS_H */