add much-needed optimizations and enhance the snake example game
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user