From: Lukas Krickl Date: Tue, 24 Feb 2026 16:37:08 +0000 (+0100) Subject: tile drawing: wip isometric rendering X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=d24cdc14053e7ef0d3bb73805a49e434486d85a4;p=lrts%2F.git tile drawing: wip isometric rendering --- diff --git a/src/lrts.c b/src/lrts.c index 2245bf0..f10e157 100644 --- a/src/lrts.c +++ b/src/lrts.c @@ -60,7 +60,12 @@ struct u_vec2 lrts_get_screen_res(void) { return screen_res; } +void lrts_init(void) { +} + int lrts_main(int argc, char **argv) { + lrts_init(); + p_io_init(); lrts_getopt(argc, argv, lrts_cfg()); diff --git a/src/r_assets.c b/src/r_assets.c index 7b36631..902f2fc 100644 --- a/src/r_assets.c +++ b/src/r_assets.c @@ -6,14 +6,21 @@ void r_draw_solid_isometric_tile(i32 x, i32 y, r_color color, r_color outline_color) { u32 i = 0; u32 j = 0; + i32 ox = 0; + i32 oy = 0; + + /* converted origin point in isometric space */ + ox = (x * R_TILE_W / 2) + (y * R_TILE_W / 2);; + oy = (y * R_TILE_H / 2) - (x * R_TILE_H / 2); LRTS_UNUSED(outline_color); LRTS_UNUSED(x); LRTS_UNUSED(y); - + + /* draw a tile texture from origin */ for (i = 0; i < R_TILE_W; i++) { for (j = 1; j < R_TILE_H-1; j++) { - r_draw_pixel(&r_framebuffer, x+i, y+j, color); + r_draw_pixel(&r_framebuffer, ox, oy, color); } } } diff --git a/src/r_render.c b/src/r_render.c index c0d5b75..b8a7455 100644 --- a/src/r_render.c +++ b/src/r_render.c @@ -28,7 +28,7 @@ void r_render_frame() { /* draw test tile */ t.type = T_TILE_TYPE_GRASS; - r_draw_tile(&t, 128, 128); + r_draw_tile(&t, 0, 0); p_draw_end(); p_draw_present();