Browse code

Progress on paint

neauoire authored on 19/02/2021 05:11:14
Showing 2 changed files
... ...
@@ -186,7 +186,6 @@ void
186 186
 redraw(Uint32 *dst, Uxn *u)
187 187
 {
188 188
 	int x, y;
189
-	/* merge layers */
190 189
 	for(y = 0; y < VER; ++y)
191 190
 		for(x = 0; x < HOR; ++x) {
192 191
 			int key = (y * HOR + x) * 16;
... ...
@@ -3,40 +3,75 @@
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 ;color 1
6
+;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2 ;color 1 ;mode 1 ;state 1 ;brush 2
7 7
 
8 8
 |0100 @RESET 
9 9
 
10 10
 	#05 =dev/r ( set dev/read mouse )
11 11
 	#02 =dev/w ( set dev/write to sprite ) 
12 12
 
13
-	#00 ,rounds_chr #0004 #0004 ,drawsprite JSR
13
+	#05 =color
14
+	,draw-interface JSR
15
+	,brush_large ,brush STR2
14 16
 
15 17
 BRK
16 18
 
17 19
 |c000 @FRAME
18 20
 	
19 21
 	#02 =dev/w ( set dev/write to sprite ) 
20
-
21 22
 	( clear last cursor )
22
-	#10 ,clear_icn ~lastx ~lasty ,drawsprite JSR
23
-
23
+	#10 ,clear_icn ~lastx ~lasty ,draw-sprite JSR
24 24
 	( record mouse values )
25 25
 	#00 IOR2 =mousex #02 IOR2 =mousey
26
-	#04 IOR #11 ADD =color
27
-
28
-	~color ,cursor_icn ~mousex ~mousey ,drawsprite JSR
29
-
30
-	( check paint )
31
-	#04 IOR #00 EQU ,skip ROT JMP? POP2
32
-		#05 ,brush_large ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,drawsprite JSR
33
-	@skip
26
+	#04 IOR #11 ADD =state
27
+	~state ,cursor_icn ~mousex ~mousey ,draw-sprite JSR
28
+
29
+	( check click )
30
+	#04 IOR #00 EQU ,end-touch ROT JMP? POP2
31
+
32
+		( check interface )
33
+		#00 IOR2 #0008 DIV2 #0001 NEQ2 ,end-interface ROT JMP? POP2
34
+
35
+			@option0
36
+			#02 IOR2 #0008 DIV2 #0004 NEQ2 ,option1 ROT JMP? POP2
37
+				,brush_large =brush BRK
38
+			@option1
39
+			#02 IOR2 #0008 DIV2 #0005 NEQ2 ,option2 ROT JMP? POP2
40
+				,brush_small =brush BRK
41
+			@option2
42
+			#02 IOR2 #0008 DIV2 #0006 NEQ2 ,option3 ROT JMP? POP2
43
+				,brush_tiny =brush BRK
44
+			@option3
45
+			#02 IOR2 #0008 DIV2 #0007 NEQ2 ,option4 ROT JMP? POP2
46
+				#05 =color BRK
47
+			@option4
48
+			#02 IOR2 #0008 DIV2 #0008 NEQ2 ,option5 ROT JMP? POP2
49
+				#06 =color BRK
50
+			@option5
51
+			#02 IOR2 #0008 DIV2 #0009 NEQ2 ,option6 ROT JMP? POP2
52
+				#07 =color BRK
53
+			@option6
54
+
55
+			BRK
56
+		@end-interface
57
+
58
+		~color ~brush ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,draw-sprite JSR
59
+	@end-touch
34 60
 
35 61
 	~mousex =lastx ~mousey =lasty
36 62
 
37 63
 BRK
38 64
 
39
-@drawsprite
65
+@draw-interface
66
+	#05 ,brush_large #0008 #0020 ,draw-sprite JSR
67
+	#05 ,brush_small #0008 #0028 ,draw-sprite JSR
68
+	#05 ,brush_tiny  #0008 #0030 ,draw-sprite JSR
69
+	#05 ,brush_large #0008 #0038 ,draw-sprite JSR
70
+	#06 ,brush_large #0008 #0040 ,draw-sprite JSR
71
+	#07 ,brush_large #0008 #0048 ,draw-sprite JSR
72
+	RTS
73
+
74
+@draw-sprite
40 75
 	IOW2 ( y byte )
41 76
 	IOW2 ( x byte )
42 77
 	IOW2 ( sprite address )
... ...
@@ -45,11 +80,11 @@ BRK
45 80
 
46 81
 |0200 @SPRITESHEET
47 82
 
48
-@rounds_chr [ 3844 92aa 9244 3800 0038 7c7c 7c38 0000 ]
49
-@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
50
-@clear_icn [ 0000 0000 0000 0000 ]
83
+@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
84
+@clear_icn   [ 0000 0000 0000 0000 ]
51 85
 @brush_large [ 387c fefe fe7c 3800 ]
52 86
 @brush_small [ 0038 7c7c 7c38 0000 ]
87
+@brush_tiny  [ 0000 1038 1000 0000 ]
53 88
 
54 89
 BRK
55 90