Browse code

Fixed blending mode

neauoire authored on 24/02/2021 00:27:20
Showing 4 changed files
... ...
@@ -14,8 +14,8 @@ WITH REGARD TO THIS SOFTWARE.
14 14
 
15 15
 #include "uxn.h"
16 16
 
17
-#define HOR 32
18
-#define VER 18
17
+#define HOR 64 / 2
18
+#define VER 48 / 2
19 19
 #define PAD 2
20 20
 #define RES (HOR * VER * 16)
21 21
 
... ...
@@ -112,6 +112,8 @@ painticn(Uint8 *dst, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 blend)
112 112
 	for(v = 0; v < 8; v++)
113 113
 		for(h = 0; h < 8; h++) {
114 114
 			Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1);
115
+			if(ch1 == 0 && (blend == 0x05 || blend == 0x0a || blend == 0x0f))
116
+				continue;
115 117
 			paintpixel(dst, x + h, y + v, ch1 ? blend % 4 : blend / 4);
116 118
 		}
117 119
 }
... ...
@@ -193,7 +195,7 @@ drawdebugger(Uint32 *dst, Uxn *u)
193 195
 		Uint8 x = (i % 8) * 3 + 3, y = i / 8 + 3, b = u->ram.dat[i];
194 196
 		drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1, 0);
195 197
 		drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1, 0);
196
-		y = i / 8 + 0x11, b = u->wst.dat[i];
198
+		y = VER - i / 8, b = u->wst.dat[i];
197 199
 		drawicn(dst, x * 8, y * 8, icons[(b >> 4) & 0xf], 1 + (u->wst.ptr == i), 0);
198 200
 		drawicn(dst, x * 8 + 8, y * 8, icons[b & 0xf], 1 + (u->wst.ptr == i), 0);
199 201
 	}
... ...
@@ -3,7 +3,8 @@
3 3
 :dev/r fff8 ( std read port )
4 4
 :dev/w fff9 ( std write port )
5 5
 
6
-;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2 
6
+&Point2d { x 2 y 2 }
7
+;mouse Point2d
7 8
 ;state 1 ;color 1 ;brush 2
8 9
 
9 10
 |0100 @RESET 
... ...
@@ -21,11 +22,11 @@ BRK
21 22
 |c000 @FRAME
22 23
 	
23 24
 	( clear last cursor )
24
-	#10 ,clear_icn ~lastx ~lasty ,draw-sprite JSR
25
+	#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR
25 26
 	( record mouse values )
26
-	#00 IOR2 =mousex #02 IOR2 =mousey
27
+	#00 IOR2 =mouse.x #02 IOR2 =mouse.y
27 28
 	#04 IOR #11 ADD =state
28
-	~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR
29
+	~state ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
29 30
 
30 31
 	( check click )
31 32
 	#04 IOR #00 EQU ,end-touch ROT JMP? POP2
... ...
@@ -47,20 +48,18 @@ BRK
47 48
 				#05 =color BRK
48 49
 			@option4
49 50
 			#02 IOR2 #0008 DIV2 #000c NEQ2 ,option5 ROT JMP? POP2
50
-				#06 =color BRK
51
+				#0a =color BRK
51 52
 			@option5
52 53
 			#02 IOR2 #0008 DIV2 #000d NEQ2 ,option6 ROT JMP? POP2
53
-				#07 =color BRK
54
+				#0f =color BRK
54 55
 			@option6
55 56
 
56 57
 			BRK
57 58
 		@end-interface
58 59
 
59
-		~color ~brush ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,draw-sprite JSR
60
+		~color ~brush ~mouse.x #0004 SUB2 ~mouse.y #0004 SUB2 ,draw-sprite JSR
60 61
 	@end-touch
61 62
 
62
-	~mousex =lastx ~mousey =lasty ( update last post )
63
-
64 63
 BRK
65 64
 
66 65
 @draw-interface
... ...
@@ -68,8 +67,8 @@ BRK
68 67
 	#05 ,brush_small #0008 #0028 ,draw-sprite JSR
69 68
 	#05 ,brush_tiny  #0008 #0030 ,draw-sprite JSR
70 69
 	#05 ,brush_large #0008 #0058 ,draw-sprite JSR
71
-	#06 ,brush_large #0008 #0060 ,draw-sprite JSR
72
-	#07 ,brush_large #0008 #0068 ,draw-sprite JSR
70
+	#0a ,brush_large #0008 #0060 ,draw-sprite JSR
71
+	#0f ,brush_large #0008 #0068 ,draw-sprite JSR
73 72
 	RTS
74 73
 
75 74
 @draw-sprite
76 75
deleted file mode 100644
... ...
@@ -1,29 +0,0 @@
1
-( blank )
2
-
3
-:dev/r fff8 ( std read port )
4
-:dev/w fff9 ( std write port )
5
-
6
-&Rect2d { x 2 y 2 width 2 height 2 }
7
-&ColorRGB { r 1 g 1 b 1 }
8
-
9
-;rc1 Rect2d
10
-;red ColorRGB
11
-
12
-|0100 @RESET
13
-	
14
-	( byte mode )
15
-	#ff =red.r
16
-	~red.r
17
-
18
-	( short mode )
19
-	#1234 =rc1.x
20
-	#abcd =rc1.height
21
-	~rc1.height
22
-
23
-BRK
24
-
25
-|c000 @FRAME BRK 
26
-|d000 @ERROR BRK 
27
-
28
-|FFF0 [ 0f32 0f32 0f32 ] ( palette )
29
-|FFFA .RESET .FRAME .ERROR
... ...
@@ -3,9 +3,13 @@
3 3
 :dev/r fff8 ( std read port )
4 4
 :dev/w fff9 ( std write port )
5 5
 
6
+&Point2d { x 2 y 2 }
7
+
8
+;mouse Point2d
9
+
6 10
 ( window )  ;wx1 2 ;wy1 2 ;wx2 2 ;wy2 2 
7 11
 ( drawing ) ;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
8
-( mouse )   ;mousex 2 ;mousey 2 ;state 1
12
+( mouse )   ;state 1
9 13
 
10 14
 |0100 @RESET 
11 15
 	
... ...
@@ -22,9 +26,9 @@ BRK
22 26
 |c000 @FRAME 
23 27
 
24 28
 	( clear last cursor )
25
-	#10 ,clear_icn ~mousex ~mousey ,draw-sprite JSR
29
+	#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR
26 30
 	( record mouse positions )
27
-	#00 IOR2 =mousex #02 IOR2 =mousey
31
+	#00 IOR2 =mouse.x #02 IOR2 =mouse.y
28 32
 	( record mouse state )
29 33
 	#04 IOR #11 ADD =state
30 34
 
... ...
@@ -33,7 +37,7 @@ BRK
33 37
 	@no-touch
34 38
 
35 39
 	( draw mouse )
36
-	~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR
40
+	~state ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
37 41
 
38 42
 BRK
39 43