Nimbin[12]?Games / Entropie / entropie/src/core/input.h

Entropie git · main

Entropie festival game; first steps

sdl c game entropie cmake · first commit 2026-10-10 · last commit 2026-11-02 (18 hours ago) · synced 10 hours ago

C 88.5% Markdown 9.1% GLSL 2.3%
git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gz
entropie/src/core/input.h 3.2 KB · 58 lines raw
#ifndef CORE_INPUT_H
#define CORE_INPUT_H

/* Per-frame player intent, read from keyboard and mouse. */

#include <stdbool.h>

typedef struct {
    bool  quit;          /* window closed */
    bool  escape;        /* Escape pressed: the menu */
    bool  enter;         /* Enter pressed */
    float mouse_x, mouse_y; /* where the pointer is (window coordinates, from the top left) */
    float move_forward;  /* -1..1  (S / W) */
    float move_right;    /* -1..1  (A / D) */
    float look_yaw;      /* degrees this frame */
    float look_pitch;    /* degrees this frame */
    bool  jump;          /* Space */
    bool  sprint;        /* Left Shift held: jog */
    bool  sprint_tap;    /* Left Shift pressed: tapping it again and again sprints */
    int   choice;        /* 1..5 pressed: answer in a conversation (0 = none) */
    bool  use_left;      /* Q pressed: pick up / drop with the left hand */
    bool  use_right;     /* E pressed: pick up / drop with the right hand */
    bool  grab;          /* F held: push / pull */
    bool  free_look;     /* Ctrl held: look around freely (holding on: without turning it) */
    bool  click;         /* left mouse pressed: take what's in front, drink, or work with a tool */
    bool  click_held;    /* left mouse held down: keep doing it */
    bool  right_click;   /* right mouse pressed: put down / let go */
    bool  pee;           /* P pressed */
    bool  smoke;         /* K pressed */
    bool  sleep;         /* Z pressed: lie down to sleep / get up */
    bool  toggle_view;   /* V pressed: first / third person */
    bool  call_help;     /* G pressed: one more person comes to help */
    bool  dismiss_help;  /* H pressed: everybody stops helping */
    bool  cancel;        /* Backspace pressed: call off what you started (showing someone how / where) */
    bool  show_keys;     /* I pressed: show / hide all keys */
    bool  show_stats;    /* Tab pressed: show / hide your stats */
    bool  throw_item;    /* T pressed: throw what you carry ... */
    bool  throw_held;    /* ... held: winding up (overhand, harder), let go: throw */
    bool  sit;           /* C pressed: sit down / get up */
    bool  call;          /* R pressed: call someone over */
    bool  talk;          /* X pressed: talk to who's in front, or shout for someone */
    int   page;          /* Right / Left arrow pressed: next / previous page (stats) */
    int   menu_move;     /* Down / Up arrow pressed: next / previous line (dev menu) */
    bool  dev_menu;      /* F1 pressed: dev menu on / off */
    bool  crew_menu;     /* F2 pressed: the crew overview on / off (dev) */
    bool  pockets;       /* B pressed: your pockets open / shut */
    bool  notes;         /* J pressed: your notebook open / shut (the festival, the why questions) */
    char  text[32];      /* typed this frame (only while typing a name: see Platform_typing) */
    bool  erase;         /* Backspace pressed (typing: one letter back) */
    bool  quick_save;    /* F5 pressed */
    bool  quick_load;    /* F9 pressed */
    bool  mute;          /* M pressed: sound off / on */
} Input;

/* Pumps SDL events and fills in the current frame's input. */
void Input_poll(Input *input);

#endif /* CORE_INPUT_H */