chore: moved mono build to lrts_impl.h
authorLukas Krickl <lukas@krickl.dev>
Thu, 26 Feb 2026 04:29:04 +0000 (05:29 +0100)
committerLukas Krickl <lukas@krickl.dev>
Thu, 26 Feb 2026 04:29:04 +0000 (05:29 +0100)
src/lrts.h
src/lrts_impl.h [new file with mode: 0644]
src/p_r_sdl/p_init.c
src/r_assets.c
src/r_color.h
src/test.c

index ffb0f6dc6fb08c7aeaaaece9d3e91a77ed67b364..aafedd14d6f866ea481cb10e06415e67ad76f008 100644 (file)
@@ -9,54 +9,6 @@
 #include "u_assert.h"
 #include "u_defs.h"
 
-
-
-/**
- * If this is an implementation
- * we include all c files for a mono-build
- */ 
-#ifdef LRTS_IMPL
-
-#include "lrts.c"
-
-/** platform specific includes **/
-#ifdef LRTS_PLATFORM_POSIX
-#include "p_pc/u_stdio.c"
-#include "p_pc/u_mem.c"
-#include "p_pc/u_assert.c"
-#include "p_posix/p_init.c"
-#include "p_posix/p_getopt.c"
-#else
-#error "No platform is provided"
-#endif
-
-#ifdef LRTS_RENDERER_TEST
-#endif
-
-
-#ifdef LRTS_RENDERER_SDL
-#include "p_r_sdl/p_init.c"
-#include "p_r_sdl/p_draw.c"
-#endif
-
-#ifdef LRTS_RENDERER_CLI
-#include "p_r_cli/p_init.c"
-#endif
-
-
-#include "t_unit.c"
-#include "u_rand.c"
-#include "n_conn.c"
-#include "u_math.c"
-#include "t_tile.c"
-#include "u_log.c"
-#include "u_arena.c"
-#include "t_map.c"
-#include "t_camera.c"
-#include "r_render.c"
-#include "r_color.c"
-#include "r_assets.c"
-
-#endif
+#include "lrts_impl.h"
 
 #endif
diff --git a/src/lrts_impl.h b/src/lrts_impl.h
new file mode 100644 (file)
index 0000000..a74fbf4
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef LRTS_IMPL_H__
+#define LRTS_IMPL_H__
+
+
+
+/**
+ * If this is an implementation
+ * we include all c files for a mono-build
+ */ 
+#ifdef LRTS_IMPL
+
+#include "lrts.c"
+
+/** platform specific includes **/
+#ifdef LRTS_PLATFORM_POSIX
+#include "p_pc/u_stdio.c"
+#include "p_pc/u_mem.c"
+#include "p_pc/u_assert.c"
+#include "p_posix/p_init.c"
+#include "p_posix/p_getopt.c"
+#else
+#error "No platform is provided"
+#endif
+
+#ifdef LRTS_RENDERER_TEST
+#endif
+
+
+#ifdef LRTS_RENDERER_SDL
+#include "p_r_sdl/p_init.c"
+#include "p_r_sdl/p_draw.c"
+#endif
+
+#ifdef LRTS_RENDERER_CLI
+#include "p_r_cli/p_init.c"
+#endif
+
+
+#include "t_unit.c"
+#include "u_rand.c"
+#include "n_conn.c"
+#include "u_math.c"
+#include "t_tile.c"
+#include "u_log.c"
+#include "u_arena.c"
+#include "t_map.c"
+#include "t_camera.c"
+#include "r_render.c"
+#include "r_color.c"
+#include "r_assets.c"
+
+#endif
+
+
+#endif
+
index 572496b227c3b3d83377d28cedbdcb788752a426..4f3f8556b8eee99faae2376fe43b18dfe1f0d2ba 100644 (file)
@@ -26,7 +26,7 @@ int p_render_init(void) {
                exit(-1);
        }
 
-       SDL_FillSurfaceRect(SDL_GetWindowSurface(p_main_window), NULL, DEFAULT_COLOR);
+       SDL_SetSurfaceColorKey(SDL_GetWindowSurface(p_main_window), LRTS_TRUE, R_COLOR_TRANSPARENT);
        u_log(U_LOG_DEBUG, "Init successful\n");
 
        return 0;
@@ -42,6 +42,8 @@ int p_render_init_framebuffer(void) {
        
        SDL_FillSurfaceRect(r_target, NULL, DEFAULT_COLOR);
 
+       SDL_SetSurfaceColorKey(r_target, LRTS_TRUE, R_COLOR_TRANSPARENT);
+
        r_framebuffer.pixels = r_target->pixels;
        r_framebuffer.width = r_target->w;
        r_framebuffer.height = r_target->h;
index 724f3dc2b7dcf533f1823ff1b9577e48ba41ed4a..0dd87baadb1cfbb0ec32ca1d3700601a0c65048f 100644 (file)
@@ -21,7 +21,7 @@ void r_draw_solid_isometric_tile(i32 x, i32 y, r_color color) {
        
        /* draw a tile texture from origin */
        for (i = 0; i < R_TILE_W; i++) {
-               for (j = 1; j < R_TILE_H-1; j++) {
+               for (j = 0; j < R_TILE_H-1; j++) {
                        final_color = r_asset_fallback_tile[i + j * R_TILE_W] & color;
                        r_draw_pixel(&r_framebuffer, t.x + i, t.y + j, final_color);
                }
index 0fee111d7777f2f7b02f6b8591bf7f367532294d..ab5725e667cd944b275954f6fd3f6cd2de513798 100644 (file)
@@ -3,6 +3,9 @@
 
 #include "u_defs.h"
 
+/* Transparent color */
+#define R_COLOR_TRANSPARENT 0xff80aa
+
 typedef u32 r_color;
 
 /*
index 9e9f97b196ee600a9b6d648158d287b45efd9ba9..605d52ebf73975bec7ab5666415f71c06eea73d8 100644 (file)
@@ -2,8 +2,6 @@
 #define LRTS_RENDERER_TESTS
 
 
-#include <stdio.h>
-#include <assert.h>
 #include "lrts.h"
 #include "p_platform.h"
 #include "tests/t_defs.h"