diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-02-24 17:55:57 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-30 08:20:21 +0200 |
| commit | 9eee43d3bb24000077602a62dfdfeee2606f1589 (patch) | |
| tree | 0e5f8efef62b068e252fe9c98c14fec723e0a7a3 /src/player/inc | |
| parent | 18717569acda82b26099c62410df3b398d596ba1 (diff) | |
| download | rts-9eee43d3bb24000077602a62dfdfeee2606f1589.tar.gz | |
Add support for keyboard and mouse
Diffstat (limited to 'src/player/inc')
| -rw-r--r-- | src/player/inc/human_player.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/player/inc/human_player.h b/src/player/inc/human_player.h index 6d97cf7..b2a07ee 100644 --- a/src/player/inc/human_player.h +++ b/src/player/inc/human_player.h @@ -2,7 +2,9 @@ #define HUMAN_PLAYER_H #include <camera.h> +#include <keyboard.h> #include <instance.h> +#include <mouse.h> #include <pad.h> #include <player.h> #include <stdbool.h> @@ -15,11 +17,34 @@ extern "C" enum {MAX_SELECTED_INSTANCES = 4}; +struct human_player_cfg +{ + enum human_player_periph + { + HUMAN_PLAYER_PERIPH_PAD, + HUMAN_PLAYER_PERIPH_KEYBOARD_MOUSE + } sel_periph; + + struct player_cfg pl; + int padn; +}; + struct human_player { struct player pl; struct camera cam; - struct pad pad; + enum human_player_periph sel_periph; + + union + { + struct pad pad; + + struct + { + struct mouse mouse; + struct keyboard keyboard; + } kbm; + } periph; struct sel_instance { @@ -52,12 +77,6 @@ struct human_player unsigned long gui_res[MAX_RESOURCE_TYPES]; }; -struct human_player_cfg -{ - struct player_cfg pl; - int padn; -}; - int human_player_init(const struct human_player_cfg *cfg, struct human_player *h); bool human_player_update(struct human_player *h, struct player_others *o); int human_player_render(const struct human_player *h, const struct player_others *o); |
