···6#include <errno.h>
7#include <sys/stat.h>
8#include "api.h"
09#ifdef _WIN32
10 #include <windows.h>
11#endif
···56 lua_pushnumber(L, e.window.data2);
57 return 3;
58 } else if (e.window.event == SDL_WINDOWEVENT_EXPOSED) {
59- SDL_UpdateWindowSurface(window);
0060 }
61 /* on some systems, when alt-tabbing to the window SDL will queue up
62 ** several KEYDOWN events for the `tab` key; we flush all keydown
···6#include <errno.h>
7#include <sys/stat.h>
8#include "api.h"
9+#include "rencache.h"
10#ifdef _WIN32
11 #include <windows.h>
12#endif
···57 lua_pushnumber(L, e.window.data2);
58 return 3;
59 } else if (e.window.event == SDL_WINDOWEVENT_EXPOSED) {
60+ rencache_invalidate();
61+ lua_pushstring(L, "exposed");
62+ return 1;
63 }
64 /* on some systems, when alt-tabbing to the window SDL will queue up
65 ** several KEYDOWN events for the `tab` key; we flush all keydown
+6-1
src/rencache.c
···150}
15115200000153void rencache_begin_frame(void) {
154 /* reset all cells if the screen width/height has changed */
155 int w, h;
···157 if (screen_rect.width != w || h != screen_rect.height) {
158 screen_rect.width = w;
159 screen_rect.height = h;
160- memset(cells_prev, 0xff, sizeof(cells_buf1));
161 }
162}
163
···150}
151152153+void rencache_invalidate(void) {
154+ memset(cells_prev, 0xff, sizeof(cells_buf1));
155+}
156+157+158void rencache_begin_frame(void) {
159 /* reset all cells if the screen width/height has changed */
160 int w, h;
···162 if (screen_rect.width != w || h != screen_rect.height) {
163 screen_rect.width = w;
164 screen_rect.height = h;
165+ rencache_invalidate();
166 }
167}
168
+1
src/rencache.h
···9void rencache_set_clip_rect(RenRect rect);
10void rencache_draw_rect(RenRect rect, RenColor color);
11int rencache_draw_text(RenFont *font, const char *text, int x, int y, RenColor color);
012void rencache_begin_frame(void);
13void rencache_end_frame(void);
14
···9void rencache_set_clip_rect(RenRect rect);
10void rencache_draw_rect(RenRect rect, RenColor color);
11int rencache_draw_text(RenFont *font, const char *text, int x, int y, RenColor color);
12+void rencache_invalidate(void);
13void rencache_begin_frame(void);
14void rencache_end_frame(void);
15