add an overdraw buffer to allow for layered rendering

This commit is contained in:
2026-10-10 10:33:56 +02:00
parent 9deb40d080
commit ea1e99f022
14 changed files with 176 additions and 38 deletions
+5 -3
View File
@@ -10,20 +10,22 @@
*/
void
put_rect(
framebuffer_e framebuffer,
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
uint32_t color
) {
) {
for (int i = x; i < x + w; i++) {
for (int j = y; j < y + h; j++) {
put_pixel(i, j, color);
put_pixel(framebuffer, i, j, color);
}
}
mark_dirty_rect(x, y, w, h);
}
// TODO: remove, see rect.h
void
clear_rect(int x, int y, int w, int h, uint32_t color)
{
@@ -33,7 +35,7 @@ clear_rect(int x, int y, int w, int h, uint32_t color)
px < game_state->width &&
py >= 0 &&
py < game_state->height) {
game_state->framebuffer[
game_state->framebuffer_base[
py * game_state->width + px
] = color;
}