diff options
Diffstat (limited to 'agbx/include')
-rw-r--r-- | agbx/include/agbx/bs.h | 6 | ||||
-rw-r--r-- | agbx/include/agbx/key.h | 33 |
2 files changed, 37 insertions, 2 deletions
diff --git a/agbx/include/agbx/bs.h b/agbx/include/agbx/bs.h index 630c50b..ab2afd1 100644 --- a/agbx/include/agbx/bs.h +++ b/agbx/include/agbx/bs.h @@ -4,12 +4,13 @@ If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#if !defined(__agbx_hdr_base) -#define __agbx_hdr_base +#if !defined(__agbx_hdr_bs) +#define __agbx_hdr_bs /* C23 compatibility: */ #define constexpr static const #define nullptr ((void *)0x0u) +#define typeof __typeof__ typedef unsigned short agbx_i10; typedef unsigned int agbx_i20; @@ -22,6 +23,7 @@ typedef enum { agbx_err_ok, agbx_err_pos2big, agbx_err_px2big, + agbx_err_max = 0xFFu, } agbx_err; constexpr agbx_i40 agbx_ver = 0x0u; diff --git a/agbx/include/agbx/key.h b/agbx/include/agbx/key.h new file mode 100644 index 0000000..973dd90 --- /dev/null +++ b/agbx/include/agbx/key.h @@ -0,0 +1,33 @@ +/* + Copyright 2022 Gabriel Jensen. + This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. + If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. +*/ + +#if !defined(__agbx_hdr_key) +#define __agbx_hdr_key + +#include <agbx/bs.h> + +typedef enum { + agbx_key_a = 0x0u, + agbx_key_b = 0x1u, + agbx_key_l = 0x9u, + agbx_key_pade = 0x4u, + agbx_key_padn = 0x6u, + agbx_key_pads = 0x7u, + agbx_key_padw = 0x5u, + agbx_key_r = 0x8u, + agbx_key_sel = 0x2u, + agbx_key_start = 0x3u, +} agbx_key; + +typedef struct { + agbx_i10 _keys; +} agbx_keymap; + +#define agbx_chkkey(_map,_key) (!(bool)(_map._keys >> (agbx_i10)_key & 0x1u)) + +agbx_keymap agbx_getkeymap(void); + +#endif |