Browse code

Starting to implement structs in the window example

neauoire authored on 24/02/2021 01:48:22
Showing 1 changed files
... ...
@@ -4,23 +4,35 @@
4 4
 :dev/w fff9 ( std write port )
5 5
 
6 6
 &Point2d { x 2 y 2 }
7
+&Icon { text 2 sprite 2 x 2 y 2 }
7 8
 
8 9
 ;mouse Point2d
10
+;pos Point2d
11
+
12
+;icon Icon
9 13
 
10 14
 ( window )  ;wx1 2 ;wy1 2 ;wx2 2 ;wy2 2 
11 15
 ( drawing ) ;color 1 ;x1 2 ;x2 2 ;y1 2 ;y2 2
12
-( mouse )   ;state 1
16
+( mouse )   ;state 1 ;wname 2
13 17
 
14 18
 |0100 @RESET 
15 19
 	
16 20
 	,paint-background JSR
17
-	#0020 #0020 #00d0 #0080 ,paint-window JSR
18
-	#0040 #0040 #00f0 #0070 ,paint-window JSR
19
-	#0060 #004c #00c0 #007a ,paint-window JSR
20 21
 
21
-	#05 =dev/r ( set dev/read mouse )
22
+	#01 =dev/r ( set read screen )
23
+
24
+	,icon_name1 ,icon_icn1 #00 IOR2 #0040 SUB2 #0000 ,paint-icon JSR
25
+	,icon_name2 ,icon_icn2 #00 IOR2 #0040 SUB2 #0030 ,paint-icon JSR
26
+	,icon_name3 ,icon_icn3 #00 IOR2 #0040 SUB2 #0090 ,paint-icon JSR
27
+
22 28
 	#02 =dev/w ( set dev/write sprite )
23 29
 
30
+	,window_name1 #0020 #0020 #00d0 #0080 ,paint-window JSR
31
+	,window_name2 #0040 #0040 #00f0 #0070 ,paint-window JSR
32
+	,window_name3 #0060 #004c #00c0 #007a ,paint-window JSR
33
+	
34
+	#05 =dev/r ( set dev/read mouse )
35
+
24 36
 BRK
25 37
 
26 38
 |c000 @FRAME 
... ...
@@ -62,7 +74,7 @@ RTS
62 74
 
63 75
 @paint-window ( wx1 wy1 wx2 wy2 )
64 76
 
65
-	=wy2 =wx2 =wy1 =wx1
77
+	=wy2 =wx2 =wy1 =wx1 =wname
66 78
 
67 79
 	#01 =dev/r ( read screen for size )
68 80
 	#01 =dev/w ( write to screen )
... ...
@@ -80,7 +92,27 @@ RTS
80 92
 
81 93
 	#02 =dev/w
82 94
 	#09 =color
83
-	,text1 ~wx1 #0008 ADD2 ~wy1 #0008 ADD2 ,draw-label JSR
95
+	~wname ~wx1 #0008 ADD2 ~wy1 #0008 ADD2 ,draw-label JSR
96
+
97
+RTS
98
+
99
+@paint-icon ( x y )
100
+
101
+	=icon.y =icon.x =icon.sprite =icon.text
102
+
103
+	#01 =dev/w ( write to screen )
104
+
105
+	#02 =dev/w ( write to sprite )
106
+	#01 =color
107
+	~icon.text ~icon.x #0008 ADD2 ~icon.y #0020 ADD2 ,draw-label JSR
108
+	#07 ~icon.sprite ~icon.x #0018 ADD2 ~icon.y #0008 ADD2
109
+	IOW2 IOW2 IOW2 IOW 
110
+	#07 ~icon.sprite #0008 ADD2 ~icon.x #0020 ADD2 ~icon.y #0008 ADD2
111
+	IOW2 IOW2 IOW2 IOW 
112
+	#07 ~icon.sprite #0010 ADD2 ~icon.x #0018 ADD2 ~icon.y #0010 ADD2
113
+	IOW2 IOW2 IOW2 IOW 
114
+	#07 ~icon.sprite #0018 ADD2 ~icon.x #0020 ADD2 ~icon.y #0010 ADD2
115
+	IOW2 IOW2 IOW2 IOW 
84 116
 
85 117
 RTS
86 118
 
... ...
@@ -132,17 +164,18 @@ RTS
132 164
 		DUP2 LDR #00 NEQ ,draw-label-loop ROT JMP? POP2
133 165
 RTS
134 166
 
135
-@texture     [ aa55 aa55 aa55 aa55 ]
136
-@clear_icn   [ 0000 0000 0000 0000 ]
137
-@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
167
+@texture       [ aa55 aa55 aa55 aa55 ]
168
+@clear_icn     [ 0000 0000 0000 0000 ]
169
+@cursor_icn    [ 80c0 e0f0 f8e0 1000 ]
138 170
 @checkoff_icn  [ 7e81 8181 8181 817e ]
139
-@checkon_icn  [ 7e81 99bd bd99 817e ]
171
+@checkon_icn   [ 7e81 99bd bd99 817e ]
140 172
 
141
-@text1 [ Planet ] <1 .00 ( add string to memory )
142
-@text2 [ To Jupiter ] <1 .00
143
-@text3 [ To Neptune ] <1 .00
144
-@text4 [ To Nereid ] <1 .00
145
-@text5 [ Theme ] <1 .00
173
+@window_name1 [ To Jupiter ] <1 .00
174
+@window_name2 [ To Neptune ] <1 .00
175
+@window_name3 [ To Nereid ] <1 .00
176
+@icon_name1 [ Disk 1 ] <1 .00
177
+@icon_name2 [ Text 1 ] <1 .00
178
+@icon_name3 [ Trash ] <1 .00
146 179
 
147 180
 @font ( spectrum-zx font ) 
148 181
 [
... ...
@@ -180,6 +213,27 @@ RTS
180 213
 	0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
181 214
 ]
182 215
 
216
+@icon_icn1 [
217
+	0000 030f 1f1e 3c38
218
+	0000 c0f0 f878 3c1c
219
+	383c 1e1f 0f03 0000
220
+	1c3c 78f8 f0c0 0000
221
+]
222
+
223
+@icon_icn2 [
224
+	ffff fdc2 fdc0 ffc0
225
+	ffff ffff ff03 ff03
226
+	ffc0 ffc0 ffff ffff
227
+	ff03 ff02 fdf9 f1ef
228
+]
229
+
230
+@icon_icn3 [
231
+	0001 0307 0f1f 3e7c
232
+	0080 c0e0 f0f8 7c3e
233
+	7c3e 1f0f 0703 0100
234
+	3e7c f8f0 e4ca 8400
235
+]
236
+
183 237
 |d000 @ERROR BRK 
184
-|FFF0 [ 31ff e1ff b10f ] ( palette )
238
+|FFF0 [ 31fd e1f3 b1f2 ] ( palette )
185 239
 |FFFA .RESET .FRAME .ERROR