-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqbpaint.bas
804 lines (760 loc) · 21.5 KB
/
qbpaint.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
PRINT "qbPaint 0.5"
_TITLE "qbPaint"
PRINT "by markus"
PRINT "Get updates from - http://pastebin.com/fj6ds1hw"
SLEEP (1)
SCREEN _NEWIMAGE(840, 480, 256)
COLOR 15, 0
PSET (29, 71), 1
LINE (234, 204)-(234, 231), 34
LINE (234, 204)-(234, 231), 34
LINE (235, 204)-(235, 231), 34
LINE (234, 205)-(234, 232), 34
LINE (236, 204)-(236, 231), 34
LINE (234, 206)-(234, 233), 34
LINE (235, 232)-(263, 232), 34
LINE (236, 232)-(264, 232), 34
LINE (235, 233)-(263, 233), 34
LINE (237, 232)-(265, 232), 34
LINE (235, 234)-(263, 234), 34
LINE (263, 204)-(263, 232), 34
LINE (264, 204)-(264, 232), 34
LINE (263, 205)-(263, 233), 34
LINE (265, 204)-(265, 232), 34
LINE (263, 206)-(263, 234), 34
LINE (236, 205)-(264, 205), 34
LINE (237, 205)-(265, 205), 34
LINE (236, 206)-(264, 206), 34
LINE (238, 205)-(266, 205), 34
LINE (236, 207)-(264, 207), 34
LINE (265, 196)-(265, 261), 34
LINE (266, 196)-(266, 261), 34
LINE (265, 197)-(265, 262), 34
LINE (267, 196)-(267, 261), 34
LINE (265, 198)-(265, 263), 34
LINE (278, 234)-(278, 167), 35
LINE (279, 234)-(279, 167), 35
LINE (278, 235)-(278, 168), 35
LINE (280, 234)-(280, 167), 35
LINE (278, 236)-(278, 169), 35
LINE (279, 234)-(304, 234), 35
LINE (280, 234)-(305, 234), 35
LINE (279, 235)-(304, 235), 35
LINE (281, 234)-(306, 234), 35
LINE (279, 236)-(304, 236), 35
LINE (304, 207)-(304, 234), 35
LINE (305, 207)-(305, 234), 35
LINE (304, 208)-(304, 235), 35
LINE (306, 207)-(306, 234), 35
LINE (304, 209)-(304, 236), 35
LINE (304, 207)-(279, 208), 35
LINE (305, 207)-(280, 208), 35
LINE (304, 208)-(279, 209), 35
LINE (306, 207)-(281, 208), 35
LINE (304, 209)-(279, 210), 35
LINE (338, 233)-(338, 160), 40
LINE (339, 233)-(339, 160), 40
LINE (338, 234)-(338, 161), 40
LINE (340, 233)-(340, 160), 40
LINE (338, 235)-(338, 162), 40
LINE (339, 161)-(370, 161), 40
LINE (340, 161)-(371, 161), 40
LINE (339, 162)-(370, 162), 40
LINE (341, 161)-(372, 161), 40
LINE (339, 163)-(370, 163), 40
LINE (370, 184)-(370, 162), 40
LINE (371, 184)-(371, 162), 40
LINE (370, 185)-(370, 163), 40
LINE (372, 184)-(372, 162), 40
LINE (370, 186)-(370, 164), 40
LINE (371, 184)-(339, 184), 40
LINE (372, 184)-(340, 184), 40
LINE (371, 185)-(339, 185), 40
LINE (373, 184)-(341, 184), 40
LINE (371, 186)-(339, 186), 40
LINE (382, 202)-(381, 230), 43
LINE (383, 202)-(382, 230), 43
LINE (382, 203)-(381, 231), 43
LINE (384, 202)-(383, 230), 43
LINE (382, 204)-(381, 232), 43
LINE (382, 231)-(414, 231), 43
LINE (383, 231)-(415, 231), 43
LINE (382, 232)-(414, 232), 43
LINE (384, 231)-(416, 231), 43
LINE (382, 233)-(414, 233), 43
LINE (414, 231)-(414, 202), 43
LINE (415, 231)-(415, 202), 43
LINE (414, 232)-(414, 203), 43
LINE (416, 231)-(416, 202), 43
LINE (414, 233)-(414, 204), 43
LINE (414, 202)-(383, 203), 43
LINE (415, 202)-(384, 203), 43
LINE (414, 203)-(383, 204), 43
LINE (416, 202)-(385, 203), 43
LINE (414, 204)-(383, 205), 43
LINE (415, 197)-(414, 232), 43
LINE (416, 197)-(415, 232), 43
LINE (415, 198)-(414, 233), 43
LINE (417, 197)-(416, 232), 43
LINE (415, 199)-(414, 234), 43
LINE (415, 225)-(422, 233), 43
LINE (416, 225)-(423, 233), 43
LINE (415, 226)-(422, 234), 43
LINE (417, 225)-(424, 233), 43
LINE (415, 227)-(422, 235), 43
LINE (439, 232)-(462, 231), 47
LINE (440, 232)-(463, 231), 47
LINE (439, 233)-(462, 232), 47
LINE (441, 232)-(464, 231), 47
LINE (439, 234)-(462, 233), 47
LINE (439, 232)-(464, 233), 47
LINE (440, 232)-(465, 233), 47
LINE (439, 233)-(464, 234), 47
LINE (441, 232)-(466, 233), 47
LINE (439, 234)-(464, 235), 47
LINE (453, 233)-(450, 194), 47
LINE (454, 233)-(451, 194), 47
LINE (453, 234)-(450, 195), 47
LINE (455, 233)-(452, 194), 47
LINE (453, 235)-(450, 196), 47
LINE (440, 194)-(451, 195), 47
LINE (441, 194)-(452, 195), 47
LINE (440, 195)-(451, 196), 47
LINE (442, 194)-(453, 195), 47
LINE (440, 196)-(451, 197), 47
LINE (450, 177)-(451, 195), 47
LINE (451, 177)-(452, 195), 47
LINE (450, 178)-(451, 196), 47
LINE (452, 177)-(453, 195), 47
LINE (450, 179)-(451, 197), 47
LINE (450, 177)-(451, 195), 0
LINE (451, 177)-(452, 195), 0
LINE (450, 178)-(451, 196), 0
LINE (452, 177)-(453, 195), 0
LINE (450, 179)-(451, 197), 0
LINE (441, 195)-(457, 195), 48
LINE (442, 195)-(458, 195), 48
LINE (441, 196)-(457, 196), 48
LINE (443, 195)-(459, 195), 48
LINE (441, 197)-(457, 197), 48
LINE (451, 177)-(451, 177), 48
LINE (452, 177)-(452, 177), 48
LINE (451, 178)-(451, 178), 48
LINE (453, 177)-(453, 177), 48
LINE (451, 179)-(451, 179), 48
LINE (449, 180)-(451, 177), 48
LINE (450, 180)-(452, 177), 48
LINE (449, 181)-(451, 178), 48
LINE (451, 180)-(453, 177), 48
LINE (449, 182)-(451, 179), 48
LINE (449, 180)-(452, 180), 48
LINE (450, 180)-(453, 180), 48
LINE (449, 181)-(452, 181), 48
LINE (451, 180)-(454, 180), 48
LINE (449, 182)-(452, 182), 48
LINE (453, 178)-(452, 180), 48
LINE (454, 178)-(453, 180), 48
LINE (453, 179)-(452, 181), 48
LINE (455, 178)-(454, 180), 48
LINE (453, 180)-(452, 182), 48
LINE (484, 235)-(483, 196), 53
LINE (485, 235)-(484, 196), 53
LINE (484, 236)-(483, 197), 53
LINE (486, 235)-(485, 196), 53
LINE (484, 237)-(483, 198), 53
LINE (484, 205)-(495, 196), 53
LINE (485, 205)-(496, 196), 53
LINE (484, 206)-(495, 197), 53
LINE (486, 205)-(497, 196), 53
LINE (484, 207)-(495, 198), 53
LINE (512, 198)-(495, 196), 53
LINE (513, 198)-(496, 196), 53
LINE (512, 199)-(495, 197), 53
LINE (514, 198)-(497, 196), 53
LINE (512, 200)-(495, 198), 53
LINE (512, 198)-(514, 233), 53
LINE (513, 198)-(515, 233), 53
LINE (512, 199)-(514, 234), 53
LINE (514, 198)-(516, 233), 53
LINE (512, 200)-(514, 235), 53
LINE (512, 198)-(515, 235), 53
LINE (513, 198)-(516, 235), 53
LINE (512, 199)-(515, 236), 53
LINE (514, 198)-(517, 235), 53
LINE (512, 200)-(515, 237), 53
LINE (551, 168)-(550, 234), 62
LINE (552, 168)-(551, 234), 62
LINE (551, 169)-(550, 235), 62
LINE (553, 168)-(552, 234), 62
LINE (551, 170)-(550, 236), 62
LINE (551, 234)-(561, 235), 62
LINE (552, 234)-(562, 235), 62
LINE (551, 235)-(561, 236), 62
LINE (553, 234)-(563, 235), 62
LINE (551, 236)-(561, 237), 62
LINE (568, 224)-(563, 235), 62
LINE (569, 224)-(564, 235), 62
LINE (568, 225)-(563, 236), 62
LINE (570, 224)-(565, 235), 62
LINE (568, 226)-(563, 237), 62
LINE (537, 181)-(564, 181), 62
LINE (538, 181)-(565, 181), 62
LINE (537, 182)-(564, 182), 62
LINE (539, 181)-(566, 181), 62
LINE (537, 183)-(564, 183), 62
nt = 194
ct = 32
ar = 0
DO WHILE nt < 637
PSET (nt, 266), ct
PSET (nt, 267), ct
PSET (nt, 268), ct
PSET (nt, 269), ct
PSET (nt, 270), ct
nt = nt + 1
ar = ar + 1
IF ar = 7 THEN
ar = 0
ct = ct + 1
END IF
LOOP
SLEEP (2)
SCREEN _NEWIMAGE(840, 480, 256)
main_color = 20
tool = 1
colorID = 1
size = 1
COLOR 15, 0
topmenu main_color, tool
trap = 0
memX1 = 0
memY1 = 0
memX2 = 0
memY2 = 0
memC = 0
memCX = 0
memCY = 0
m2emC = 0
m2emCX = 0
m2emCY = 0
bdcolor = 0
debug = 1
IF debug = 1 THEN
OPEN "qbPaintOut.txt" FOR OUTPUT AS #1
TextStart ("qbPaint 0.5 Auto Out")
END IF
DO
DO WHILE _MOUSEINPUT
mouseX = _MOUSEX
mouseY = _MOUSEY
colorID = colorID + _MOUSEWHEEL
LOOP
'topbar
LOCATE 1, 1
PRINT " x: "
LOCATE 1, 4
PRINT mouseX
LOCATE 1, 10
PRINT " y: "
LOCATE 1, 13
PRINT mouseY
LOCATE 1, 19
PRINT " color: "
LOCATE 1, 26
PRINT colorID
LOCATE 1, 32
PRINT " tool: "
LOCATE 1, 38
PRINT tool
LOCATE 1, 44
PRINT " size: "
LOCATE 1, 50
PRINT size
LOCATE 1, 98
PRINT " qbPaint"
'draw color block
IF pastcolorID <> colorID THEN
LINE (840, 480)-(800, 440), main_color, BF
LINE (838, 478)-(802, 442), colorID, BF
pastcolorID = colorID
END IF
'call to paint
IF _MOUSEBUTTON(1) OR _MOUSEBUTTON(2) OR _MOUSEBUTTON(3) THEN
callPaint tool, mouseX, mouseY, colorID
trap = 1
ELSE
IF trap = 1 THEN
trap = 0
'call to button
callButton mouseX, mouseY
'recreate topmenu
topmenu main_color, tool
END IF
END IF
'keys
LET k$ = INKEY$
SELECT CASE k$
CASE "1"
size = 1
CASE "2"
size = 2
CASE "3"
size = 3
CASE "`"
'recreate topmenu
topmenu main_color, tool
CASE "q"
tool = 1
topmenu main_color, tool
CASE "w"
tool = 2
topmenu main_color, tool
CASE "e"
tool = 3
topmenu main_color, tool
CASE "r"
tool = 4
topmenu main_color, tool
CASE "t"
tool = 5
topmenu main_color, tool
CASE "0"
colorID = 0
topmenu main_color, tool
CASE "s"
save
CASE "o"
openfile
CASE " "
IF tool = 2 THEN
DrawLine mouseX, mouseY, colorID
END IF
IF tool = 3 THEN
DrawCube mouseX, mouseY, colorID, 1
END IF
IF tool = 5 THEN
DrawCircle mouseX, mouseY, colorID
END IF
CASE "/"
IF tool = 3 THEN
DrawCube mouseX, mouseY, colorID, 0
END IF
END SELECT
LOOP
'topmenu
SUB topmenu (main_color, tool)
'Bar
LINE (0, 0)-(40, 480), main_color, BF
'draw mega color block
nt = 520
ct = 32
ar = 0
DO WHILE nt < 800
PSET (nt, 465), ct
PSET (nt, 466), ct
PSET (nt, 467), ct
PSET (nt, 468), ct
PSET (nt, 469), ct
PSET (nt, 470), ct
PSET (nt, 471), ct
PSET (nt, 472), ct
PSET (nt, 473), ct
PSET (nt, 474), ct
PSET (nt, 475), ct
PSET (nt, 476), ct
PSET (nt, 477), ct
PSET (nt, 478), ct
PSET (nt, 479), ct
nt = nt + 1
ar = ar + 1
IF ar = 5 THEN
ar = 0
ct = ct + 1
END IF
LOOP
'Brush
IF tool = 1 THEN
LINE (2, 17)-(38, 53), 4, BF
LINE (3, 18)-(37, 52), 15, BF
ELSE
LINE (2, 17)-(38, 53), 0, BF
LINE (3, 18)-(37, 52), 7, BF
END IF
LINE (4, 27)-(12, 19), 0
LINE (12, 19)-(31, 38), 0
LINE (31, 38)-(31, 46), 0
LINE (31, 46)-(23, 46), 0
LINE (23, 46)-(4, 27), 0
LINE (31, 38)-(23, 46), 0
PAINT (20, 35), 14, 0
PAINT (29, 44), 6, 0
'Line
IF tool = 2 THEN
LINE (2, 17 + 39)-(38, 53 + 39), 4, BF
LINE (3, 18 + 39)-(37, 52 + 39), 15, BF
ELSE
LINE (2, 17 + 39)-(38, 53 + 39), 0, BF
LINE (3, 18 + 39)-(37, 52 + 39), 7, BF
END IF
LINE (6, 21 + 39)-(34, 49 + 39), 4
LINE (7, 21 + 39)-(35, 49 + 39), 4
LINE (5, 21 + 39)-(33, 49 + 39), 4
'Cube
IF tool = 3 THEN
LINE (2, 17 + 80)-(38, 53 + 80), 4, BF
LINE (3, 18 + 80)-(37, 52 + 80), 15, BF
ELSE
LINE (2, 17 + 80)-(38, 53 + 80), 0, BF
LINE (3, 18 + 80)-(37, 52 + 80), 7, BF
END IF
LINE (7, 25 + 80)-(33, 45 + 80), 4, BF
LINE (8, 26 + 80)-(32, 44 + 80), 90, BF
'Fill
IF tool = 4 THEN
LINE (2, 17 + 121)-(38, 53 + 121), 4, BF
LINE (3, 18 + 121)-(37, 52 + 121), 15, BF
ELSE
LINE (2, 17 + 121)-(38, 53 + 121), 0, BF
LINE (3, 18 + 121)-(37, 52 + 121), 7, BF
END IF
LINE (7, 22 + 121)-(15, 19 + 121), 0
LINE (15, 19 + 121)-(23, 19 + 121), 0
LINE (23, 19 + 121)-(31, 22 + 121), 0
LINE (7, 22 + 121)-(15, 27 + 121), 0
LINE (15, 27 + 121)-(23, 27 + 121), 0
LINE (23, 27 + 121)-(31, 22 + 121), 0
LINE (7, 22 + 121)-(11, 46 + 121), 0
LINE (11, 46 + 121)-(27, 46 + 121), 0
LINE (27, 46 + 121)-(31, 22 + 121), 0
PAINT (20, 156), 26, 0
SHARED bdcolor
PAINT (18, 143), bdcolor, 0
'Circle
IF tool = 5 THEN
LINE (2, 17 + 162)-(38, 53 + 162), 4, BF
LINE (3, 18 + 162)-(37, 52 + 162), 15, BF
ELSE
LINE (2, 17 + 162)-(38, 53 + 162), 0, BF
LINE (3, 18 + 162)-(37, 52 + 162), 7, BF
END IF
CIRCLE (19, 35 + 162), 13, 4
PAINT (19, 35 + 162), 90, 4
END SUB
SUB callPaint (tool, mouseX, mouseY, colorID)
SHARED size
'tools
IF tool = 1 AND _MOUSEBUTTON(1) THEN ' Brush
Brush mouseX, mouseY, colorID, size
END IF
IF tool = 2 THEN ' Line
LineDraw mouseX, mouseY, colorID, size
END IF
IF tool = 3 THEN ' Cube
CubeDraw mouseX, mouseY, colorID, size
END IF
IF tool = 4 THEN ' Fill
DrawFill mouseX, mouseY, colorID
END IF
IF tool = 5 THEN ' Circle
CircleDraw mouseX, mouseY, colorID, size
END IF
IF _MOUSEBUTTON(3) THEN 'Pipetka
colorID = POINT(mouseX, mouseY)
END IF
END SUB
SUB callButton (mouseX, mouseY)
'buttons
SHARED tool
IF mouseX > 3 AND mouseX < 37 AND mouseY > 18 AND mouseY < 52 THEN ' Brush
tool = 1
END IF
IF mouseX > 3 AND mouseX < 37 AND mouseY > 18 + 39 AND mouseY < 52 + 39 THEN ' Line
tool = 2
END IF
IF mouseX > 3 AND mouseX < 37 AND mouseY > 18 + 80 AND mouseY < 52 + 80 THEN ' Cube
tool = 3
END IF
IF mouseX > 3 AND mouseX < 37 AND mouseY > 18 + 121 AND mouseY < 52 + 121 THEN ' Fill
tool = 4
END IF
IF mouseX > 3 AND mouseX < 37 AND mouseY > 18 + 162 AND mouseY < 52 + 162 THEN ' Circle
tool = 5
END IF
END SUB
SUB Brush (mouseX, mouseY, colorID, size)
SHARED debug
IF size = 1 THEN
IF debug = 1 AND POINT(mouseX, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
PSET (mouseX, mouseY), colorID
END IF
IF size = 2 THEN
IF debug = 1 THEN
IF POINT(mouseX, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 1, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 1) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX, mouseY + 1) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY + 1) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 1, mouseY + 1) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 1) + "," + STR$(mouseY + 1) + ")" + "," + STR$(colorID))
END IF
END IF
PSET (mouseX, mouseY), colorID
PSET (mouseX + 1, mouseY), colorID
PSET (mouseX, mouseY + 1), colorID
PSET (mouseX + 1, mouseY + 1), colorID
END IF
IF size = 3 THEN
IF debug = 1 THEN
IF POINT(mouseX, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 1, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 1) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX, mouseY + 1) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY + 1) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 1, mouseY + 1) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 1) + "," + STR$(mouseY + 1) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 2, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 2) + "," + STR$(mouseY) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 2, mouseY) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 2) + "," + STR$(mouseY + 1) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 2, mouseY + 2) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 2) + "," + STR$(mouseY + 2) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX + 1, mouseY + 2) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX + 1) + "," + STR$(mouseY + 2) + ")" + "," + STR$(colorID))
END IF
IF POINT(mouseX, mouseY + 2) <> colorID THEN
TextAutoOut ("PSET (" + STR$(mouseX) + "," + STR$(mouseY + 2) + ")" + "," + STR$(colorID))
END IF
END IF
PSET (mouseX, mouseY), colorID
PSET (mouseX + 1, mouseY), colorID
PSET (mouseX, mouseY + 1), colorID
PSET (mouseX + 1, mouseY + 1), colorID
PSET (mouseX + 2, mouseY), colorID
PSET (mouseX + 2, mouseY + 1), colorID
PSET (mouseX + 2, mouseY + 2), colorID
PSET (mouseX + 1, mouseY + 2), colorID
PSET (mouseX, mouseY + 2), colorID
END IF
END SUB
SUB LineDraw (mouseX, mouseY, colorID, size)
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
IF _MOUSEBUTTON(1) THEN
memX1 = mouseX
memY1 = mouseY
SupportDraw mouseX, mouseY
END IF
IF _MOUSEBUTTON(2) THEN
memX2 = mouseX
memY2 = mouseY
SupportDraw2 mouseX, mouseY
END IF
END SUB
SUB DrawLine (mouseX, mouseY, colorID)
SHARED debug
SHARED size
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
IF size = 1 THEN
IF debug = 1 THEN
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1) + ") - (" + STR$(memX2) + "," + STR$(memY2) + "), " + STR$(colorID))
END IF
LINE (memX1, memY1)-(memX2, memY2), colorID
END IF
IF size = 2 THEN
IF debug = 1 THEN
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1) + ") - (" + STR$(memX2) + "," + STR$(memY2) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1 + 1) + "," + STR$(memY1) + ") - (" + STR$(memX2 + 1) + "," + STR$(memY2) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1 + 1) + ") - (" + STR$(memX2) + "," + STR$(memY2 + 1) + "), " + STR$(colorID))
END IF
LINE (memX1, memY1)-(memX2, memY2), colorID
LINE (memX1 + 1, memY1)-(memX2 + 1, memY2), colorID
LINE (memX1, memY1 + 1)-(memX2, memY2 + 1), colorID
END IF
IF size = 3 THEN
IF debug = 1 THEN
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1) + ") - (" + STR$(memX2) + "," + STR$(memY2) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1 + 1) + "," + STR$(memY1) + ") - (" + STR$(memX2 + 1) + "," + STR$(memY2) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1 + 1) + ") - (" + STR$(memX2) + "," + STR$(memY2 + 1) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1 + 2) + "," + STR$(memY1) + ") - (" + STR$(memX2 + 2) + "," + STR$(memY2) + "), " + STR$(colorID))
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1 + 2) + ") - (" + STR$(memX2) + "," + STR$(memY2 + 2) + "), " + STR$(colorID))
END IF
LINE (memX1, memY1)-(memX2, memY2), colorID
LINE (memX1 + 1, memY1)-(memX2 + 1, memY2), colorID
LINE (memX1, memY1 + 1)-(memX2, memY2 + 1), colorID
LINE (memX1 + 2, memY1)-(memX2 + 2, memY2), colorID
LINE (memX1, memY1 + 2)-(memX2, memY2 + 2), colorID
END IF
END SUB
SUB SupportDraw (mouseX, mouseY)
SHARED memC
SHARED memCX
SHARED memCY
PSET (memCX, memCY), memC
memC = POINT(mouseX, mouseY)
memCX = mouseX
memCY = mouseY
PSET (mouseX, mouseY), 4
END SUB
SUB SupportDraw2 (mouseX, mouseY)
SHARED m2emC
SHARED m2emCX
SHARED m2emCY
PSET (m2emCX, m2emCY), m2emC
m2emC = POINT(mouseX, mouseY)
m2emCX = mouseX
m2emCY = mouseY
PSET (mouseX, mouseY), 2
END SUB
SUB CubeDraw (mouseX, mouseY, colorID, size)
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
IF _MOUSEBUTTON(1) THEN
memX1 = mouseX
memY1 = mouseY
SupportDraw mouseX, mouseY
END IF
IF _MOUSEBUTTON(2) THEN
memX2 = mouseX
memY2 = mouseY
SupportDraw2 mouseX, mouseY
END IF
END SUB
SUB CircleDraw (mouseX, mouseY, colorID, size)
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
IF _MOUSEBUTTON(1) THEN
memX1 = mouseX
memY1 = mouseY
SupportDraw mouseX, mouseY
END IF
IF _MOUSEBUTTON(2) THEN
memX2 = mouseX
memY2 = mouseY
SupportDraw2 mouseX, mouseY
END IF
END SUB
SUB DrawCube (mouseX, mouseY, colorID, fill)
SHARED debug
SHARED size
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
IF fill = 1 THEN
IF debug = 1 THEN
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1) + ") - (" + STR$(memX2) + "," + STR$(memY2) + "), " + STR$(colorID) + ", BF")
END IF
LINE (memX1, memY1)-(memX2, memY2), colorID, BF
END IF
IF fill = 0 THEN
IF debug = 1 THEN
TextAutoOut ("LINE (" + STR$(memX1) + "," + STR$(memY1) + ") - (" + STR$(memX2) + "," + STR$(memY2) + "), " + STR$(colorID) + ", B")
END IF
LINE (memX1, memY1)-(memX2, memY2), colorID, B
END IF
END SUB
SUB DrawCircle (mouseX, mouseY, colorID)
SHARED debug
SHARED size
SHARED memX1
SHARED memY1
SHARED memX2
SHARED memY2
d = SQR((memX2 - memX1) ^ 2 + (memY2 - memY1) ^ 2)
IF debug = 1 THEN
TextAutoOut ("CIRCLE (" + STR$(memX1) + "," + STR$(memY1) + "), " + STR$(d) + ", " + STR$(colorID))
END IF
CIRCLE (memX1, memY1), d, colorID
END SUB
SUB DrawFill (mouseX, mouseY, colorID)
SHARED debug
SHARED bdcolor
IF _MOUSEBUTTON(1) THEN
IF debug = 1 AND POINT(mouseX, mouseY) <> colorID THEN
TextAutoOut ("PAINT (" + STR$(mouseX) + "," + STR$(mouseY) + ")" + "," + STR$(colorID) + "," + STR$(bdcolor))
END IF
PAINT (mouseX, mouseY), colorID, bdcolor
END IF
IF _MOUSEBUTTON(2) THEN
bdcolor = POINT(mouseX, mouseY)
END IF
END SUB
SUB TextAutoOut (text$)
PRINT #1, text$
END SUB
SUB TextStart (comment$)
PRINT #1, "'", comment$
PRINT #1, "SCREEN _NEWIMAGE(840, 480, 256)"
PRINT #1, "COLOR 15, 0"
END SUB
SUB save
' 41 16
OPEN "save.txt" FOR OUTPUT AS #2
sx = 41
sy = 16
ex = 840
ey = 480
nx = sx
ny = sy
LOCATE 1, 1
PRINT " "
pic = 0
DO WHILE nx <> ex OR ny <> ey
nx = sx
DO WHILE nx <> ex
pic = pic + 1
PRINT #2, STR$(nx) + " " + STR$(ny) + " " + STR$(POINT(nx, ny))
SupportDraw nx, ny
nx = nx + 1
LOCATE 1, 1
PRINT "Save: " + STR$(INT(pic / 370736 * 100)) + "%"
LOOP
ny = ny + 1
LOOP
CLOSE #2
END SUB
SUB openfile
IF _FILEEXISTS("save.txt") THEN
OPEN "save.txt" FOR INPUT AS #3
lines = 0
LOCATE 1, 1
PRINT " "
DO UNTIL EOF(3)
LINE INPUT #3, s$
s$ = LTRIM$(s$)
l$ = LEFT$(s$, INSTR(s$, " ") - 1)
r$ = RIGHT$(s$, LEN(s$) - LEN(l$))
m$ = LEFT$(LTRIM$(r$), INSTR(LTRIM$(r$), " ") - 1)
h$ = LTRIM$(RIGHT$(LTRIM$(r$), LEN(LTRIM$(r$)) - LEN(m$)))
PSET (VAL(l$), VAL(m$)), VAL(h$)
lines = lines + 1
LOCATE 1, 1
PRINT "Open: " + STR$(INT(lines / 370736 * 100)) + "%"
LOOP
PRINT #1, lines
CLOSE #3
END IF
END SUB