summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2025-03-12 23:26:01 +0200
committerjussi2025-03-12 23:26:01 +0200
commit63f3c1781cec32bd4603cd92a9b788e3000a9594 (patch)
tree977b1847a2b7cd4c1dada94597a19a6acaa72c1b /src
parentbfa73944f7e8a3a239ed105871a0912e8b22ed15 (diff)
downloadreilua-enhanced-63f3c1781cec32bd4603cd92a9b788e3000a9594.tar.gz
reilua-enhanced-63f3c1781cec32bd4603cd92a9b788e3000a9594.tar.bz2
reilua-enhanced-63f3c1781cec32bd4603cd92a9b788e3000a9594.zip
Basic sdl3 support.
Diffstat (limited to 'src')
-rw-r--r--src/gl.c2
-rw-r--r--src/lua_core.c8
-rw-r--r--src/platforms/core_desktop_sdl2.c (renamed from src/platforms/core_desktop_sdl.c)2
-rw-r--r--src/platforms/core_desktop_sdl3.c23
-rw-r--r--src/state.c2
5 files changed, 31 insertions, 6 deletions
diff --git a/src/gl.c b/src/gl.c
index 4082e27..38fa7fe 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -32,7 +32,7 @@ Copy a block of pixels from one framebuffer object to another.
Use nil RenderTexture for window framebuffer
*/
int lglBlitFramebuffer( lua_State* L ) {
-#if defined( PLATFORM_DESKTOP ) || defined( PLATFORM_DESKTOP_SDL )
+#if defined( PLATFORM_DESKTOP ) || defined( PLATFORM_DESKTOP_SDL2 ) || defined( PLATFORM_DESKTOP_SDL3 )
if ( !( lua_isuserdata( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isuserdata( L, 2 ) || lua_isnil( L, 2 ) ) ) {
TraceLog( state->logLevelInvalid, "%s", "Argument needs to be RenderTexture or nil" );
lua_pushnil( L );
diff --git a/src/lua_core.c b/src/lua_core.c
index de90e89..0191e98 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -17,8 +17,10 @@
#ifdef PLATFORM_DESKTOP
#include "platforms/core_desktop_glfw.c"
-#elif PLATFORM_DESKTOP_SDL
- #include "platforms/core_desktop_sdl.c"
+#elif PLATFORM_DESKTOP_SDL2
+ #include "platforms/core_desktop_sdl2.c"
+#elif PLATFORM_DESKTOP_SDL3
+ #include "platforms/core_desktop_sdl3.c"
#elif PLATFORM_WEB
#include "platforms/core_web.c"
#endif
@@ -1451,7 +1453,7 @@ void luaCallInit() {
void luaCallUpdate() {
-#if defined PLATFORM_DESKTOP_SDL && defined LUA_EVENTS
+#if defined PLATFORM_DESKTOP_SDL2 && defined LUA_EVENTS
platformSendEvents();
#endif
lua_State* L = state->luaState;
diff --git a/src/platforms/core_desktop_sdl.c b/src/platforms/core_desktop_sdl2.c
index 4105b25..ce105ee 100644
--- a/src/platforms/core_desktop_sdl.c
+++ b/src/platforms/core_desktop_sdl2.c
@@ -1,7 +1,7 @@
#include "main.h"
#include "lua_core.h"
#include "core.h"
-#include "platforms/core_desktop_sdl.h"
+#include "platforms/core_desktop_sdl2.h"
void platformDefineGlobals() {
lua_State* L = state->luaState;
diff --git a/src/platforms/core_desktop_sdl3.c b/src/platforms/core_desktop_sdl3.c
new file mode 100644
index 0000000..9314b26
--- /dev/null
+++ b/src/platforms/core_desktop_sdl3.c
@@ -0,0 +1,23 @@
+#include "main.h"
+#include "lua_core.h"
+#include "core.h"
+#include "platforms/core_desktop_sdl3.h"
+
+void platformDefineGlobals() {
+ lua_State* L = state->luaState;
+
+ lua_getglobal( L, "RL" );
+/*DOC_DEFINES_START*/
+/*DOC_DEFINES_END*/
+ lua_pop( L, -1 );
+}
+
+void luaPlatformRegister() {
+ // lua_State* L = state->luaState;
+ // lua_getglobal( L, "RL" );
+
+ // lua_pop( L, -1 );
+#ifdef LUA_EVENTS
+ // platformRegisterEvents();
+#endif
+}
diff --git a/src/state.c b/src/state.c
index fdfdbd0..8f8c03d 100644
--- a/src/state.c
+++ b/src/state.c
@@ -29,7 +29,7 @@ void stateContextInit() {
state->defaultTexture = (Texture){ 1, 1, 1, 1, 7 };
state->shapesTexture = (Texture){ 1, 1, 1, 1, 7 };
state->RLGLcurrentShaderLocs = malloc( RL_MAX_SHADER_LOCATIONS * sizeof( int ) );
-#ifdef PLATFORM_DESKTOP_SDL
+#ifdef PLATFORM_DESKTOP_SDL2
state->SDL_eventQueue = malloc( PLATFORM_SDL_EVENT_QUEUE_LEN * sizeof( SDL_Event ) );
state->SDL_eventQueueLen = 0;
#endif