MCPcopy Create free account
hub / github.com/DavidColson/Polybox / InputState

Class InputState

source/input.cpp:20–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18};
19
20struct InputState {
21 Arena* pArena;
22
23 // Mapping of strings to virtual controller buttons
24 HashMap<u32, ControllerButton> stringToControllerButton;
25
26 // Mapping of strings to virtual controller axis
27 HashMap<u32, ControllerAxis> stringToControllerAxis;
28
29 // Mapping of strings to SDL scancodes
30 HashMap<u32, SDL_Keycode> stringToKeyCode;
31
32 // Mapping of strings to SDL scancodes
33 HashMap<SDL_Keycode, Key> keyCodeToInternalKeyCode;
34
35 // Mapping of strings to SDL mouse codes
36 HashMap<u32, i32> stringToMouseCode;
37
38 // Mapping of strings to SDL controller buttons
39 HashMap<u32, SDL_GameControllerButton> stringToSDLControllerButton;
40
41 // Mapping of strings to SDL controller pInputState->axes
42 HashMap<u32, SDL_GameControllerAxis> stringToSDLControllerAxis;
43
44 HashMap<SDL_GameControllerButton, ControllerButton> primaryBindings;
45 HashMap<SDL_GameControllerAxis, ControllerAxis> primaryAxisBindings;
46
47 HashMap<SDL_Keycode, ControllerButton> keyboardAltBindings;
48 HashMap<int, ControllerButton> mouseAltBindings;
49
50 HashMap<SDL_Keycode, ControllerAxis> keyboardAxisBindings;
51 HashMap<int, ControllerAxis> mouseAxisBindings;
52
53 bool keyDowns[(u64)Key::Count];
54 bool keyUps[(u64)Key::Count];
55 bool keyStates[(u64)Key::Count];
56
57 bool buttonDowns[(u64)ControllerButton::Count];
58 bool buttonUps[(u64)ControllerButton::Count];
59 bool buttonStates[(u64)ControllerButton::Count];
60
61 Axis axes[(u64)ControllerAxis::Count];
62
63 SDL_GameController* pOpenController { nullptr };
64
65 StringBuilder textInputString;
66
67 Vec2f targetResolution;
68 Vec2f windowResolution;
69};
70
71InputState* pInputState;
72

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected