add much-needed optimizations and enhance the snake example game

This commit is contained in:
2026-10-05 03:45:46 +02:00
parent e72588f792
commit 78ae90391a
7 changed files with 295 additions and 32 deletions
+8
View File
@@ -41,6 +41,8 @@ typedef struct {
uint32_t framebuffer[WINDOW_WIDTH * WINDOW_HEIGHT];
SDL_Event event;
bool is_running;
bool framebuffer_dirty;
SDL_Rect dirty_rect;
uint16_t width, height;
} game_state_t;
@@ -88,6 +90,12 @@ clear_framebuffer(
uint32_t color
);
void
clear_rect(int x, int y, int w, int h, uint32_t color);
void
mark_dirty_rect(int x, int y, int w, int h);
void
put_char(
char c,