commit 12cb8e2
Devine Lu Linvega
·
2024-01-21 00:39:27 +0000 UTC
parent 2dff217
Housekeeping
3 files changed,
+26,
-31
+2,
-2
1@@ -17,9 +17,9 @@
2
3 @on-mouse ( -> )
4 ( | clear background )
5- ( #0000 DUP2 .Screen/x DEO2
6+ #0000 DUP2 .Screen/x DEO2
7 .Screen/y DEO2
8- #80 .Screen/pixel DEO )
9+ #80 .Screen/pixel DEO
10 <draw-guide>
11 ( | cursor )
12 #41 ;cursor-icn <update-cursor>
+23,
-27
1@@ -34,7 +34,6 @@ twos(Uint16 value)
2 return (int)value;
3 }
4
5-
6 static void
7 screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
8 {
9@@ -88,7 +87,7 @@ screen_changed(void)
10 uxn_screen.y2 = 0;
11 else if(uxn_screen.y2 >= uxn_screen.height)
12 uxn_screen.y2 = uxn_screen.height;
13- return uxn_screen.x2 > uxn_screen.x1 || uxn_screen.y2 > uxn_screen.y1;
14+ return uxn_screen.x2 > uxn_screen.x1 && uxn_screen.y2 > uxn_screen.y1;
15 }
16
17 void
18@@ -99,24 +98,6 @@ screen_change(int x1, int y1, int x2, int y2)
19 if(x2 > uxn_screen.x2) uxn_screen.x2 = x2;
20 if(y2 > uxn_screen.y2) uxn_screen.y2 = y2;
21 }
22-
23-void
24-screen_fill(Uint8 *layer, int color)
25-{
26- int i, length = uxn_screen.width * uxn_screen.height;
27- for(i = 0; i < length; i++)
28- layer[i] = color;
29-}
30-
31-void
32-screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
33-{
34- int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
35- for(y = y1; y < y2 && y < h; y++)
36- for(x = x1, row = y * w; x < x2 && x < w; x++)
37- layer[x + row] = color;
38-}
39-
40 /* clang-format off */
41
42 static Uint8 icons[] = {
43@@ -165,6 +146,23 @@ screen_debugger(Uxn *u)
44 draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
45 }
46
47+void
48+screen_fill(Uint8 *layer, int color)
49+{
50+ int i, length = uxn_screen.width * uxn_screen.height;
51+ for(i = 0; i < length; i++)
52+ layer[i] = color;
53+}
54+
55+void
56+screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
57+{
58+ int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
59+ for(y = y1; y < y2 && y < h; y++)
60+ for(x = x1, row = y * w; x < x2 && x < w; x++)
61+ layer[x + row] = color;
62+}
63+
64 void
65 screen_palette(Uint8 *addr)
66 {
67@@ -190,7 +188,6 @@ screen_resize(Uint16 width, Uint16 height, int scale)
68 return;
69 if(uxn_screen.width == width && uxn_screen.height == height && uxn_screen.scale == scale)
70 return;
71-
72 if(dim_change) {
73 bg = malloc(width * height), fg = malloc(width * height);
74 if(bg && fg)
75@@ -206,7 +203,6 @@ screen_resize(Uint16 width, Uint16 height, int scale)
76 if(!pixels)
77 return;
78 }
79-
80 uxn_screen.bg = bg, uxn_screen.fg = fg;
81 uxn_screen.pixels = pixels;
82 uxn_screen.width = width, uxn_screen.height = height, uxn_screen.scale = scale;
83@@ -326,14 +322,14 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
84 for(i = 0; i <= rML; i++, rA += addr_incr)
85 screen_1bpp(layer, &ram[rA], rX + dyx * i, rY + dxy * i, color, fx, fy);
86 if(fx == -1)
87- x1 = rX + dyx * rML, x2 = rX + 8;
88+ x1 = rX + dyx * rML, x2 = rX;
89 else
90- x1 = rX, x2 = rX + dyx * rML + 8;
91+ x1 = rX, x2 = rX + dyx * rML;
92 if(fy == -1)
93- y1 = rY + dxy * rML, y2 = rY + 8;
94+ y1 = rY + dxy * rML, y2 = rY;
95 else
96- y1 = rY, y2 = rY + dxy * rML + 8;
97- screen_change(x1, y1, x2, y2);
98+ y1 = rY, y2 = rY + dxy * rML;
99+ screen_change(x1, y1, x2 + 8, y2 + 8);
100 if(rMX) rX += rDX * fx;
101 if(rMY) rY += rDY * fy;
102 return;
+1,
-2
1@@ -22,12 +22,11 @@ typedef struct UxnScreen {
2 extern UxnScreen uxn_screen;
3 extern int emu_resize(int width, int height);
4 int screen_changed(void);
5-void normalize_rect(void);
6+void screen_change(int x1, int y1, int x2, int y2);
7 void screen_fill(Uint8 *layer, int color);
8 void screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color);
9 void screen_palette(Uint8 *addr);
10 void screen_resize(Uint16 width, Uint16 height, int scale);
11-void screen_change(int x1, int y1, int x2, int y2);
12 void screen_redraw(Uxn *u);
13
14 Uint8 screen_dei(Uxn *u, Uint8 addr);