commit 5ee804a
Devine Lu Linvega
·
2025-04-08 22:39:04 +0000 UTC
parent b31eb47
Improved screen resize
3 files changed,
+6,
-8
+3,
-3
1@@ -86,7 +86,7 @@ screen_resize(Uint16 width, Uint16 height, int scale)
2 for(i = 0; i < length; i++)
3 uxn_screen.bg[i] = uxn_screen.fg[i] = 0;
4 }
5- uxn_screen.reqw = uxn_screen.reqh = 0;
6+ uxn_screen.resize = 0;
7 screen_change(0, 0, width, height);
8 emu_resize(width, height);
9 }
10@@ -137,8 +137,8 @@ screen_deo(Uint8 addr)
11 {
12 switch(addr) {
13 case 0x21: uxn_screen.vector = PEEK2(&uxn.dev[0x20]); return;
14- case 0x23: uxn_screen.reqw = uxn_screen.width = PEEK2(&uxn.dev[0x22]); return;
15- case 0x25: uxn_screen.reqh = uxn_screen.height = PEEK2(&uxn.dev[0x24]); return;
16+ case 0x23: uxn_screen.width = PEEK2(&uxn.dev[0x22]), uxn_screen.resize = 1; return;
17+ case 0x25: uxn_screen.height = PEEK2(&uxn.dev[0x24]), uxn_screen.resize = 1; return;
18 case 0x26: rMX = uxn.dev[0x26] & 0x1, rMY = uxn.dev[0x26] & 0x2, rMA = uxn.dev[0x26] & 0x4, rML = uxn.dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return;
19 case 0x28:
20 case 0x29: rX = (uxn.dev[0x28] << 8) | uxn.dev[0x29], rX = twos(rX); return;
+1,
-1
1@@ -10,7 +10,7 @@ WITH REGARD TO THIS SOFTWARE.
2 */
3
4 typedef struct UxnScreen {
5- int width, height, reqw, reqh, vector, scale, x1, y1, x2, y2;
6+ int width, height, resize, vector, scale, x1, y1, x2, y2;
7 Uint32 palette[16], *pixels;
8 Uint8 *fg, *bg;
9 } UxnScreen;
+2,
-4
1@@ -244,10 +244,8 @@ emu_run(void)
2 read(fds[1].fd, expirations, 8);
3 if(uxn_screen.vector)
4 uxn_eval(uxn_screen.vector);
5- if(uxn_screen.reqw || uxn_screen.reqh)
6- screen_resize(uxn_screen.reqw ? uxn_screen.reqw : uxn_screen.width,
7- uxn_screen.reqh ? uxn_screen.reqh : uxn_screen.height,
8- uxn_screen.scale);
9+ if(uxn_screen.resize)
10+ screen_resize(uxn_screen.width, uxn_screen.height, uxn_screen.scale);
11 if(uxn_screen.x2 && uxn_screen.y2 && screen_changed()) {
12 int x = uxn_screen.x1 * uxn_screen.scale, y = uxn_screen.y1 * uxn_screen.scale;
13 int w = uxn_screen.x2 * uxn_screen.scale - x, h = uxn_screen.y2 * uxn_screen.scale - y;