diff options
author | Henrique Lacreta Alves <henriquelalves@gmail.com> | 2024-05-14 10:12:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-14 10:12:39 +0300 |
commit | 9859882f9f37f3eee6f9b90348c7e3c2ed229c49 (patch) | |
tree | 3f89305088b7f14965dce6c15af45b95b3eb0472 /sources | |
parent | 569c6856d1bc1b873b317a470d8d1591f92568a2 (diff) | |
parent | 9999ea36e68e910af8dbf1f8b0c0fc4bf2c3b6a5 (diff) | |
download | gamejam-slgj-2024-9859882f9f37f3eee6f9b90348c7e3c2ed229c49.tar.gz gamejam-slgj-2024-9859882f9f37f3eee6f9b90348c7e3c2ed229c49.tar.bz2 gamejam-slgj-2024-9859882f9f37f3eee6f9b90348c7e3c2ed229c49.zip |
Merge pull request #4 from gilzoide/automatic-raylib-enums
Automatic bindings for raylib enums
Diffstat (limited to 'sources')
-rw-r--r-- | sources/main.c | 2 | ||||
-rw-r--r-- | sources/rl/enums.c | 118 | ||||
-rw-r--r-- | sources/rl/enums.h | 9 |
3 files changed, 129 insertions, 0 deletions
diff --git a/sources/main.c b/sources/main.c index 7196bc4..4f899ce 100644 --- a/sources/main.c +++ b/sources/main.c @@ -9,6 +9,7 @@ #include "rl/text.h" #include "rl/texture.h" #include "rl/core.h" +#include "rl/enums.h" #include "rl/shapes.h" #include "repl/repl.h" @@ -48,6 +49,7 @@ int main(int argc, char* argv[]) { s7 = s7_init(); rl_register_types(s7); + rl_register_enums(s7); rl_text_define_methods(s7); rl_texture_define_methods(s7); rl_core_define_methods(s7); diff --git a/sources/rl/enums.c b/sources/rl/enums.c new file mode 100644 index 0000000..7a055e2 --- /dev/null +++ b/sources/rl/enums.c @@ -0,0 +1,118 @@ +// This file was automatically generated by tools/generate_raylib_enums.py +// Any manual modifications will be overwritten when running the script again +#include "enums.h" +#include "raylib.h" + +void rl_register_enums(s7_scheme *s7) { + // enum KeyboardKey + S7_DEFINE_ENUM(s7, KEY_NULL); + S7_DEFINE_ENUM(s7, KEY_APOSTROPHE); + S7_DEFINE_ENUM(s7, KEY_COMMA); + S7_DEFINE_ENUM(s7, KEY_MINUS); + S7_DEFINE_ENUM(s7, KEY_PERIOD); + S7_DEFINE_ENUM(s7, KEY_SLASH); + S7_DEFINE_ENUM(s7, KEY_ZERO); + S7_DEFINE_ENUM(s7, KEY_ONE); + S7_DEFINE_ENUM(s7, KEY_TWO); + S7_DEFINE_ENUM(s7, KEY_THREE); + S7_DEFINE_ENUM(s7, KEY_FOUR); + S7_DEFINE_ENUM(s7, KEY_FIVE); + S7_DEFINE_ENUM(s7, KEY_SIX); + S7_DEFINE_ENUM(s7, KEY_SEVEN); + S7_DEFINE_ENUM(s7, KEY_EIGHT); + S7_DEFINE_ENUM(s7, KEY_NINE); + S7_DEFINE_ENUM(s7, KEY_SEMICOLON); + S7_DEFINE_ENUM(s7, KEY_EQUAL); + S7_DEFINE_ENUM(s7, KEY_A); + S7_DEFINE_ENUM(s7, KEY_B); + S7_DEFINE_ENUM(s7, KEY_C); + S7_DEFINE_ENUM(s7, KEY_D); + S7_DEFINE_ENUM(s7, KEY_E); + S7_DEFINE_ENUM(s7, KEY_F); + S7_DEFINE_ENUM(s7, KEY_G); + S7_DEFINE_ENUM(s7, KEY_H); + S7_DEFINE_ENUM(s7, KEY_I); + S7_DEFINE_ENUM(s7, KEY_J); + S7_DEFINE_ENUM(s7, KEY_K); + S7_DEFINE_ENUM(s7, KEY_L); + S7_DEFINE_ENUM(s7, KEY_M); + S7_DEFINE_ENUM(s7, KEY_N); + S7_DEFINE_ENUM(s7, KEY_O); + S7_DEFINE_ENUM(s7, KEY_P); + S7_DEFINE_ENUM(s7, KEY_Q); + S7_DEFINE_ENUM(s7, KEY_R); + S7_DEFINE_ENUM(s7, KEY_S); + S7_DEFINE_ENUM(s7, KEY_T); + S7_DEFINE_ENUM(s7, KEY_U); + S7_DEFINE_ENUM(s7, KEY_V); + S7_DEFINE_ENUM(s7, KEY_W); + S7_DEFINE_ENUM(s7, KEY_X); + S7_DEFINE_ENUM(s7, KEY_Y); + S7_DEFINE_ENUM(s7, KEY_Z); + S7_DEFINE_ENUM(s7, KEY_LEFT_BRACKET); + S7_DEFINE_ENUM(s7, KEY_BACKSLASH); + S7_DEFINE_ENUM(s7, KEY_RIGHT_BRACKET); + S7_DEFINE_ENUM(s7, KEY_GRAVE); + S7_DEFINE_ENUM(s7, KEY_SPACE); + S7_DEFINE_ENUM(s7, KEY_ESCAPE); + S7_DEFINE_ENUM(s7, KEY_ENTER); + S7_DEFINE_ENUM(s7, KEY_TAB); + S7_DEFINE_ENUM(s7, KEY_BACKSPACE); + S7_DEFINE_ENUM(s7, KEY_INSERT); + S7_DEFINE_ENUM(s7, KEY_DELETE); + S7_DEFINE_ENUM(s7, KEY_RIGHT); + S7_DEFINE_ENUM(s7, KEY_LEFT); + S7_DEFINE_ENUM(s7, KEY_DOWN); + S7_DEFINE_ENUM(s7, KEY_UP); + S7_DEFINE_ENUM(s7, KEY_PAGE_UP); + S7_DEFINE_ENUM(s7, KEY_PAGE_DOWN); + S7_DEFINE_ENUM(s7, KEY_HOME); + S7_DEFINE_ENUM(s7, KEY_END); + S7_DEFINE_ENUM(s7, KEY_CAPS_LOCK); + S7_DEFINE_ENUM(s7, KEY_SCROLL_LOCK); + S7_DEFINE_ENUM(s7, KEY_NUM_LOCK); + S7_DEFINE_ENUM(s7, KEY_PRINT_SCREEN); + S7_DEFINE_ENUM(s7, KEY_PAUSE); + S7_DEFINE_ENUM(s7, KEY_F1); + S7_DEFINE_ENUM(s7, KEY_F2); + S7_DEFINE_ENUM(s7, KEY_F3); + S7_DEFINE_ENUM(s7, KEY_F4); + S7_DEFINE_ENUM(s7, KEY_F5); + S7_DEFINE_ENUM(s7, KEY_F6); + S7_DEFINE_ENUM(s7, KEY_F7); + S7_DEFINE_ENUM(s7, KEY_F8); + S7_DEFINE_ENUM(s7, KEY_F9); + S7_DEFINE_ENUM(s7, KEY_F10); + S7_DEFINE_ENUM(s7, KEY_F11); + S7_DEFINE_ENUM(s7, KEY_F12); + S7_DEFINE_ENUM(s7, KEY_LEFT_SHIFT); + S7_DEFINE_ENUM(s7, KEY_LEFT_CONTROL); + S7_DEFINE_ENUM(s7, KEY_LEFT_ALT); + S7_DEFINE_ENUM(s7, KEY_LEFT_SUPER); + S7_DEFINE_ENUM(s7, KEY_RIGHT_SHIFT); + S7_DEFINE_ENUM(s7, KEY_RIGHT_CONTROL); + S7_DEFINE_ENUM(s7, KEY_RIGHT_ALT); + S7_DEFINE_ENUM(s7, KEY_RIGHT_SUPER); + S7_DEFINE_ENUM(s7, KEY_KB_MENU); + S7_DEFINE_ENUM(s7, KEY_KP_0); + S7_DEFINE_ENUM(s7, KEY_KP_1); + S7_DEFINE_ENUM(s7, KEY_KP_2); + S7_DEFINE_ENUM(s7, KEY_KP_3); + S7_DEFINE_ENUM(s7, KEY_KP_4); + S7_DEFINE_ENUM(s7, KEY_KP_5); + S7_DEFINE_ENUM(s7, KEY_KP_6); + S7_DEFINE_ENUM(s7, KEY_KP_7); + S7_DEFINE_ENUM(s7, KEY_KP_8); + S7_DEFINE_ENUM(s7, KEY_KP_9); + S7_DEFINE_ENUM(s7, KEY_KP_DECIMAL); + S7_DEFINE_ENUM(s7, KEY_KP_DIVIDE); + S7_DEFINE_ENUM(s7, KEY_KP_MULTIPLY); + S7_DEFINE_ENUM(s7, KEY_KP_SUBTRACT); + S7_DEFINE_ENUM(s7, KEY_KP_ADD); + S7_DEFINE_ENUM(s7, KEY_KP_ENTER); + S7_DEFINE_ENUM(s7, KEY_KP_EQUAL); + S7_DEFINE_ENUM(s7, KEY_BACK); + S7_DEFINE_ENUM(s7, KEY_MENU); + S7_DEFINE_ENUM(s7, KEY_VOLUME_UP); + S7_DEFINE_ENUM(s7, KEY_VOLUME_DOWN); +} diff --git a/sources/rl/enums.h b/sources/rl/enums.h new file mode 100644 index 0000000..02b779c --- /dev/null +++ b/sources/rl/enums.h @@ -0,0 +1,9 @@ +#pragma once + +#include "s7/s7.h" + +/// Defines an enum in s7 with the same name and value as in C +#define S7_DEFINE_ENUM(s7, x) \ + s7_define_variable(s7, #x, s7_make_integer(s7, x)) + +void rl_register_enums(s7_scheme *s7); |