diff options
| author | jussi | 2023-11-23 00:00:49 +0200 |
|---|---|---|
| committer | jussi | 2023-11-23 00:00:49 +0200 |
| commit | 1ab9722875c543e8fd1b6600fd16e51412181641 (patch) | |
| tree | 412a3b0d139daa8832217e9e4240bd1cd299d4c5 /include | |
| parent | 85a48cf09302a2a14aeeb2d6cf3b8fcc1607e222 (diff) | |
| download | reilua-enhanced-1ab9722875c543e8fd1b6600fd16e51412181641.tar.gz reilua-enhanced-1ab9722875c543e8fd1b6600fd16e51412181641.tar.bz2 reilua-enhanced-1ab9722875c543e8fd1b6600fd16e51412181641.zip | |
Support for different platforms. Platform_desktop_sdl.
Diffstat (limited to 'include')
| -rw-r--r-- | include/lua_core.h | 22 | ||||
| -rw-r--r-- | include/main.h | 9 | ||||
| -rw-r--r-- | include/platforms/core_desktop.h | 16 | ||||
| -rw-r--r-- | include/platforms/core_desktop_sdl.h | 8 | ||||
| -rw-r--r-- | include/state.h | 7 |
5 files changed, 44 insertions, 18 deletions
diff --git a/include/lua_core.h b/include/lua_core.h index 431fc28..6c81aaa 100644 --- a/include/lua_core.h +++ b/include/lua_core.h @@ -1,20 +1,5 @@ #pragma once -enum EventType { - EVENT_WINDOW_SIZE, - EVENT_WINDOW_MAXIMIZE, - EVENT_WINDOW_ICONYFY, - EVENT_WINDOW_FOCUS, - EVENT_WINDOW_DROP, - EVENT_KEY, - EVENT_CHAR, - EVENT_MOUSE_BUTTON, - EVENT_MOUSE_CURSOR_POS, - EVENT_MOUSE_SCROLL, - EVENT_CURSOR_ENTER, - EVENT_JOYSTICK -}; - enum BufferType { BUFFER_UNSIGNED_CHAR, BUFFER_UNSIGNED_SHORT, @@ -32,6 +17,13 @@ typedef struct { void *data; } Buffer; +/* Global assing functions. */ +void assignGlobalInt( int value, const char *name ); +void assignGlobalFloat( float value, const char *name ); +void assignGlobalDouble( double value, const char *name ); +void assignGlobalColor( Color color, const char *name ); +void assingGlobalFunction( const char *name, int ( *functionPtr )( lua_State* ) ); + bool luaInit( int argn, const char **argc ); int luaTraceback( lua_State *L ); bool luaCallMain(); diff --git a/include/main.h b/include/main.h index 4795121..fc711b8 100644 --- a/include/main.h +++ b/include/main.h @@ -13,8 +13,13 @@ #include <stdint.h> #include "glad.h" -#include "glfw3.h" -#include "glfw3native.h" + +#ifdef PLATFORM_DESKTOP + #include "glfw3.h" + #include "glfw3native.h" +#elif PLATFORM_DESKTOP_SDL + #include <SDL.h> +#endif #ifdef SHARED #include <raylib.h> diff --git a/include/platforms/core_desktop.h b/include/platforms/core_desktop.h new file mode 100644 index 0000000..c3da090 --- /dev/null +++ b/include/platforms/core_desktop.h @@ -0,0 +1,16 @@ +#pragma once + +enum EventType { + GLFW_WINDOW_SIZE_EVENT, + GLFW_WINDOW_MAXIMIZE_EVENT, + GLFW_WINDOW_ICONYFY_EVENT, + GLFW_WINDOW_FOCUS_EVENT, + GLFW_WINDOW_DROP_EVENT, + GLFW_KEY_EVENT, + GLFW_CHAR_EVENT, + GLFW_MOUSE_BUTTON_EVENT, + GLFW_MOUSE_CURSOR_POS_EVENT, + GLFW_MOUSE_SCROLL_EVENT, + GLFW_CURSOR_ENTER_EVENT, + GLFW_JOYSTICK_EVENT +}; diff --git a/include/platforms/core_desktop_sdl.h b/include/platforms/core_desktop_sdl.h new file mode 100644 index 0000000..479b2a1 --- /dev/null +++ b/include/platforms/core_desktop_sdl.h @@ -0,0 +1,8 @@ +#pragma once + +// #include "SDL.h" + +enum EventType { + SDL_WINDOW_EVENT, + SDL_KEYBOARD_EVENT +}; diff --git a/include/state.h b/include/state.h index a777f40..4b2fe2c 100644 --- a/include/state.h +++ b/include/state.h @@ -13,7 +13,9 @@ typedef struct { Font defaultFont; Material defaultMaterial; int *RLGLcurrentShaderLocs; - /* Raylib GLFW input callback events. */ + /* Events. */ + /* GLFW events. */ +#ifdef PLATFORM_DESKTOP /* Window events. */ GLFWwindowsizefun raylibWindowSizeCallback; GLFWwindowmaximizefun raylibWindowMaximizeCallback; @@ -28,6 +30,9 @@ typedef struct { GLFWscrollfun raylibMouseScrollCallback; GLFWcursorenterfun raylibCursorEnterCallback; GLFWjoystickfun raylibJoystickCallback; +// #elif PLATFORM_DESKTOP_SDL + +#endif } State; extern State *state; |
