From: Lukas Krickl Date: Thu, 26 Feb 2026 04:29:04 +0000 (+0100) Subject: chore: moved mono build to lrts_impl.h X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=fff9c7f2be22b7e9e1eadae2a3e6149bcc54394a;p=lrts%2F.git chore: moved mono build to lrts_impl.h --- diff --git a/src/lrts.h b/src/lrts.h index ffb0f6d..aafedd1 100644 --- a/src/lrts.h +++ b/src/lrts.h @@ -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 index 0000000..a74fbf4 --- /dev/null +++ b/src/lrts_impl.h @@ -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 + diff --git a/src/p_r_sdl/p_init.c b/src/p_r_sdl/p_init.c index 572496b..4f3f855 100644 --- a/src/p_r_sdl/p_init.c +++ b/src/p_r_sdl/p_init.c @@ -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; diff --git a/src/r_assets.c b/src/r_assets.c index 724f3dc..0dd87ba 100644 --- a/src/r_assets.c +++ b/src/r_assets.c @@ -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); } diff --git a/src/r_color.h b/src/r_color.h index 0fee111..ab5725e 100644 --- a/src/r_color.h +++ b/src/r_color.h @@ -3,6 +3,9 @@ #include "u_defs.h" +/* Transparent color */ +#define R_COLOR_TRANSPARENT 0xff80aa + typedef u32 r_color; /* diff --git a/src/test.c b/src/test.c index 9e9f97b..605d52e 100644 --- a/src/test.c +++ b/src/test.c @@ -2,8 +2,6 @@ #define LRTS_RENDERER_TESTS -#include -#include #include "lrts.h" #include "p_platform.h" #include "tests/t_defs.h"