1 
2 #ifndef _INPUT_H
3 #define _INPUT_H
4 #include <SDL.h>
5 #include <string>
6 
7 typedef struct
8 {
9   int32_t key;
10   int32_t jbut;
11   int32_t jhat;
12   int32_t jhat_value;
13   int32_t jaxis;
14   int32_t jaxis_value;
15 } in_action;
16 
17 enum INPUTS
18 {
19   LEFTKEY,
20   RIGHTKEY,
21   UPKEY,
22   DOWNKEY,
23   JUMPKEY,
24   FIREKEY,
25   STRAFEKEY,
26   PREVWPNKEY,
27   NEXTWPNKEY,
28   INVENTORYKEY,
29   MAPSYSTEMKEY,
30 
31   ESCKEY,
32   F1KEY,
33   F2KEY,
34   F3KEY,
35   F4KEY,
36   F5KEY,
37   F6KEY,
38   F7KEY,
39   F8KEY,
40   F9KEY,
41   F10KEY,
42   F11KEY,
43   F12KEY,
44 
45   FREEZE_FRAME_KEY,
46   FRAME_ADVANCE_KEY,
47   DEBUG_FLY_KEY,
48   ENTERKEY,
49 
50   INPUT_COUNT
51 };
52 
53 #define LASTCONTROLKEY MAPSYSTEMKEY
54 
55 #define DEBUG_GOD_KEY F1KEY
56 #define DEBUG_MOVE_KEY F2KEY
57 #define DEBUG_SAVE_KEY F4KEY
58 #define FFWDKEY F5KEY
59 
60 extern bool inputs[INPUT_COUNT];
61 extern bool lastinputs[INPUT_COUNT];
62 extern in_action last_sdl_action;
63 extern SDL_Joystick *joy;
64 extern int ACCEPT_BUTTON;
65 extern int DECLINE_BUTTON;
66 
67 bool input_init(void);
68 void input_remap(int keyindex, in_action sdl_key);
69 in_action input_get_mapping(int keyindex);
70 const std::string input_get_name(int index);
71 void input_set_mappings(in_action *array);
72 void input_poll(void);
73 void input_close(void);
74 bool buttondown(void);
75 bool buttonjustpushed(void);
76 bool justpushed(int k);
77 void rumble(float str, uint32_t len);
78 
79 #endif
80