Reduce redraws

This commit is contained in:
neauoire 2023-08-16 13:29:15 -07:00
parent 867701b5dc
commit c09a047851
2 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@ CLI_src=src/uxn.c src/devices/system.c src/devices/console.c src/devices/file.c
EMU_src=${CLI_src} src/devices/screen.c src/devices/controller.c src/devices/mouse.c
RELEASE_flags=-DNDEBUG -O2 -g0 -s
RELEASE_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined
DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined
.PHONY: all debug dest rom run test install uninstall format clean

View File

@ -224,6 +224,11 @@ emu_run(Uxn *u, char *rom)
if(poll(&fds[1], 1, 0)) {
read(fds[1].fd, expirations, 8); /* Indicate we handled the timer */
uxn_eval(u, PEEK2(u->dev + 0x20)); /* Call the vector once, even if the timer fired multiple times */
if(uxn_screen.x2) {
int x1 = uxn_screen.x1, y1 = uxn_screen.y1, x2 = uxn_screen.x2, y2 = uxn_screen.y2;
screen_redraw(u);
XPutImage(display, window, DefaultGC(display, 0), ximage, x1, y1, x1 + PAD, y1 + PAD, x2 - x1, y2 - y1);
}
}
if((fds[2].revents & POLLIN) != 0) {
n = read(fds[2].fd, coninp, CONINBUFSIZE - 1);
@ -231,11 +236,6 @@ emu_run(Uxn *u, char *rom)
for(i = 0; i < n; i++)
console_input(u, coninp[i], CONSOLE_STD);
}
if(uxn_screen.x2) {
int x1 = uxn_screen.x1, y1 = uxn_screen.y1, x2 = uxn_screen.x2, y2 = uxn_screen.y2;
screen_redraw(u);
XPutImage(display, window, DefaultGC(display, 0), ximage, x1, y1, x1 + PAD, y1 + PAD, x2 - x1, y2 - y1);
}
}
return 1;
}