diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-21 22:42:28 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-21 22:42:28 +0100 |
commit | b4c2ff850930cb29da1a331b17fcc8a9e561b5ff (patch) | |
tree | e3b5a6c0d4a4454cc13afc8cc72bdc1e476e8569 /src/vga.c | |
parent | d3c44c1472ab23a8ea37cc63f3f9f8678b0a6af5 (diff) | |
download | gold-mine-run-b4c2ff850930cb29da1a331b17fcc8a9e561b5ff.tar.gz gold-mine-run-b4c2ff850930cb29da1a331b17fcc8a9e561b5ff.zip |
Add color text
Diffstat (limited to 'src/vga.c')
-rw-r--r-- | src/vga.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -101,6 +101,25 @@ void blit(const uint8_t *sprite, const Rect *dst) } } +void blit_c(const uint8_t *sprite, const Rect *dst, uint8_t c) +{ + for (int32_t j = dst->y * 320; j < (dst->y + dst->h) * 320; j += 320) + for (int16_t i = dst->x; i < dst->x + dst->w; i++) + { + uint8_t b = *sprite++; + + /* transparent */ + if (b == TRANSPARENT) + continue; + + /* clipping */ + if (i < 0 || i >= 320 || j < 0 || j >= 200 * 320) + continue; + + buffer[i + j] = b ? c : b; + } +} + void blitrc(const uint8_t *sprite, const Rect *src, const Rect *dst) { for (int32_t j = dst->y * 320, sy = src->y * src->w; j < (dst->y + dst->h) * 320; j += 320, sy += src->w) |