Mercurial > molko
diff libmlk-core/mlk/core/event.h @ 443:dfc65293d984
core: initial gamepad support
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 21 Jan 2023 20:20:34 +0100 |
parents | 8f59201dc76b |
children | 773a082f0b91 |
line wrap: on
line diff
--- a/libmlk-core/mlk/core/event.h Thu Nov 03 21:09:25 2022 +0100 +++ b/libmlk-core/mlk/core/event.h Sat Jan 21 20:20:34 2023 +0100 @@ -22,6 +22,7 @@ #include "core.h" #include "key.h" #include "mouse.h" +#include "gamepad.h" enum event_type { EVENT_CLICKDOWN, @@ -29,6 +30,9 @@ EVENT_KEYDOWN, EVENT_KEYUP, EVENT_MOUSE, + EVENT_PADUP, + EVENT_PADDOWN, + EVENT_AXIS, EVENT_QUIT, EVENT_NUM }; @@ -53,11 +57,24 @@ unsigned int clicks; }; +struct mlk_event_pad { + enum event_type type; + enum mlk_gamepad_button button; +}; + +struct mlk_event_axis { + enum event_type type; + enum mlk_gamepad_axis axis; + int value; +}; + union event { enum event_type type; struct event_key key; struct event_mouse mouse; struct event_click click; + struct mlk_event_pad pad; + struct mlk_event_axis axis; }; CORE_BEGIN_DECLS