From 0b86e0d8e96ccb313bd8033aec013f29fe8a8b99 Mon Sep 17 00:00:00 2001 From: kkard2 Date: Sat, 6 Sep 2025 14:29:05 +0200 Subject: multiple examples --- sponge.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sponge.h') diff --git a/sponge.h b/sponge.h index a383b0a..6255236 100644 --- a/sponge.h +++ b/sponge.h @@ -1,28 +1,28 @@ #include -// TODO(kard): consider storing pixels buffer size typedef struct { // TODO(kard): define byte order uint32_t *pixels; uint32_t width; uint32_t height; uint32_t stride; -} sponge_Canvas; +} sponge_Texture; -void sponge_clear(sponge_Canvas c, uint32_t color); -void sponge_draw_rect(sponge_Canvas c, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t color); +void sponge_clear(sponge_Texture c, uint32_t color); +void sponge_draw_rect(sponge_Texture c, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t color); +void sponge_draw_texture(sponge_Texture c, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, sponge_Texture texture); // TODO(kard): prefix stripping #ifdef SPONGE_IMPLEMENTATION -void sponge_clear(sponge_Canvas c, uint32_t color) { +void sponge_clear(sponge_Texture c, uint32_t color) { sponge_draw_rect(c, 0, 0, c.width - 1, c.height - 1, color); } // TODO(kard): probably bounds checking // TODO(kard): alpha blending maybe -void sponge_draw_rect(sponge_Canvas c, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t color) { +void sponge_draw_rect(sponge_Texture c, uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint32_t color) { uint32_t *row = c.pixels + (y0 * c.stride); for (uint32_t y = y0; y <= y1; y++, row += c.stride) { -- cgit v1.3.1