public
Created

An MS paint clone written in 1996.

  • Download Gist
doodle.bas
Visual Basic
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 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901
'PAINT.BAS by Tony Lieuallen .99f 3/4/96 -
'$DYNAMIC
 
DEFINT A-Z
COMMON SHARED Mx, My, LBut, RBut, FColor, BColor, Tool, Sides
COMMON SHARED FilName$
 
TYPE RegType
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
bp AS INTEGER
si AS INTEGER
di AS INTEGER
flags AS INTEGER
END TYPE
DECLARE SUB Interrupt (intnum, reg1 AS RegType, reg2 AS RegType)
 
DECLARE SUB MSetRange (x0, y0, X1, Y1)
DECLARE SUB MGetLoc (Mx, My)
DECLARE SUB Minit ()
DECLARE SUB MButton (LBut, RBut, My, Mx, BBut)
DECLARE SUB MShowCurs ()
DECLARE SUB MHideCurs ()
DECLARE SUB GPrint (Txt$, X, Y, Style)
DECLARE SUB MDefGrfCurs (Shape$(), HotX, HotY)
DECLARE SUB MSetLoc (My, Mx)
DECLARE SUB GraphColor (Clr)
DECLARE SUB GLineEdit (Txt$, X, Y, Style, Options, KeyCode)
DECLARE FUNCTION MRange (x0, y0, X1, Y1, Mx, My)
 
DECLARE SUB CustomCursor (FileNum)
DECLARE SUB DrawingTools ()
DECLARE SUB FileLoad ()
DECLARE SUB FileSave ()
DECLARE SUB Icon (X, Y, Wid, High, Title$)
DECLARE SUB InitScreen ()
DECLARE SUB PrintCoords ()
DECLARE SUB PutPic (X, Y, Pic$)
DECLARE SUB TeaseScreen ()
 
SCREEN 8, , 0, 0
 
'$INCLUDE: 'packed.ico'
CONST Pi = 3.141593
FColor = 0
BColor = 15
Tool = 2
DIM SHARED FillArea(26908) AS INTEGER
DIM SHARED FillString(0 TO 175) AS STRING * 595
 
MHideCurs
CustomCursor 1
InitScreen
TeaseScreen
LINE (47, 24)-(640, 200), BColor, BF
MShowCurs
 
PCOPY 0, 2: PCOPY 0, 3
MSetLoc 100, 320
CustomCursor 2
 
DO
MButton LBut, RBut, My, Mx, BBut
MGetLoc My, Mx
IF Mx > 47 AND My > 24 THEN
IF OMx <> Mx OR OMy <> My THEN PrintCoords
ELSE
LINE (545, 2)-(640, 19), 15, BF
END IF
OMx = Mx: OMy = My
 
Key$ = INKEY$
SELECT CASE Key$
CASE CHR$(27): SYSTEM
END SELECT
IF LBut OR RBut THEN
IF MRange(1, 1, 40, 19, Mx, My) THEN
MHideCurs
PCOPY 0, 2
Icon 2, 20, 40, 19, "Save"
Icon 2, 40, 40, 19, "Load"
Icon 2, 60, 40, 19, "Quit"
MShowCurs
MSetRange 2, 2, 40, 80
LBut = 0: RBut = 0
DO UNTIL LBut
MButton LBut, RBut, My, Mx, BBut
LOOP
IF My > 60 THEN SYSTEM
IF My < 61 AND My > 40 THEN
MHideCurs
PCOPY 2, 0
Icon 70, 92, 180, 16, "Please type the name:"
Icon 125, 110, 85, 16, ""
FilName$ = SPACE$(8)
GLineEdit FilName$, 135, 115, 1, 0, KeyCode
FilName$ = RTRIM$(FilName$) + ".doo"
PCOPY 2, 0
IF FilName$ <> ".doo" THEN FileLoad
PCOPY 0, 2
MShowCurs
END IF
IF My < 41 AND My > 20 THEN
MHideCurs
PCOPY 2, 0
Icon 70, 92, 180, 16, "Please type the name:"
Icon 125, 110, 85, 16, ""
FilName$ = SPACE$(8)
GLineEdit FilName$, 135, 115, 1, 0, KeyCode
FilName$ = RTRIM$(FilName$) + ".doo"
PCOPY 2, 0
IF FilName$ <> ".doo" THEN FileSave
MShowCurs
END IF
MHideCurs
PCOPY 2, 0
MShowCurs
MSetRange 1, 1, 640, 200
LBut = 0: RBut = 0
PrintCoords
ELSEIF MRange(45, 1, 90, 19, Mx, My) THEN
MHideCurs
PCOPY 0, 2
Icon 45, 20, 43, 19, "Clear"
Icon 45, 40, 43, 19, "Undo"
LBut = 0: RBut = 0
MSetRange 45, 2, 90, 59
MShowCurs
DO UNTIL LBut
MButton LBut, RBut, My, Mx, BBut
LOOP
MHideCurs
PCOPY 2, 0
IF My < 20 THEN
ELSEIF My > 19 AND My < 40 THEN
LINE (47, 24)-(640, 200), BColor, BF
ELSEIF My > 39 AND My < 60 THEN
PCOPY 3, 0
END IF
MSetRange 1, 1, 640, 200
MShowCurs
LBut = 0: RBut = 0
PrintCoords
ELSEIF MRange(90, 1, 110, 19, Mx, My) THEN Tool = 1
ELSEIF MRange(115, 1, 135, 19, Mx, My) THEN Tool = 2
ELSEIF MRange(140, 1, 160, 19, Mx, My) THEN Tool = 3
ELSEIF MRange(165, 1, 185, 19, Mx, My) THEN Tool = 4
ELSEIF MRange(190, 1, 210, 19, Mx, My) THEN
IF Tool = 5 THEN
MHideCurs
PCOPY 0, 2
Icon 190, 20, 20, 19, ""
LINE (198, 27)-(204, 33), 0
Icon 190, 40, 20, 19, ""
LINE (198, 47)-(204, 53), 0
LINE (204, 47)-(198, 53), 0
LINE (201, 44)-(201, 56), 0
LINE (195, 50)-(208, 50), 0
MShowCurs
MSetRange 190, 20, 210, 60
DO UNTIL LBut AND My > 20
MButton LBut, RBut, My, Mx, BBut
LOOP
Tool = 5
IF My > 40 THEN Tool = 50
MHideCurs
PCOPY 2, 0
MShowCurs
MSetRange 1, 1, 640, 200
LBut = 0: RBut = 0
PrintCoords
ELSE
Tool = 5
END IF
ELSEIF MRange(215, 1, 235, 19, Mx, My) THEN
IF Tool = 6 OR Tool = 60 THEN
MHideCurs
PCOPY 0, 2
Icon 215, 20, 20, 19, ""
LINE (222, 27)-(228, 33), 0, B
Icon 215, 40, 20, 19, ""
LINE (222, 47)-(228, 53), 0, B
LINE (223, 48)-(227, 52), 15, BF
MShowCurs
MSetRange 215, 20, 235, 60
DO UNTIL LBut AND My > 20
MButton LBut, RBut, My, Mx, BBut
LOOP
Tool = 6
IF My > 40 THEN Tool = 60
MHideCurs
PCOPY 2, 0
MShowCurs
MSetRange 1, 1, 640, 200
LBut = 0: RBut = 0
PrintCoords
ELSE
Tool = 6
END IF
ELSEIF MRange(240, 1, 260, 19, Mx, My) THEN
IF Tool = 7 OR Tool = 70 OR Tool = 71 OR Tool = 710 THEN
MHideCurs
PCOPY 0, 2
Icon 240, 20, 20, 19, ""
CIRCLE (250, 30), 4, 0, , , 1
Icon 240, 40, 20, 19, ""
CIRCLE (250, 50), 4, 0, , , 1
PAINT (250, 50), 15, 0
Icon 240, 60, 20, 19, ""
CIRCLE (250, 70), 4, 0, , , 1.5
Icon 240, 80, 20, 19, ""
CIRCLE (250, 90), 4, 0, , , 1.5
PAINT (250, 90), 15, 0
MShowCurs
MSetRange 240, 20, 260, 100
LBut = 0
DO UNTIL LBut
MButton LBut, RBut, My, Mx, BBut
LOOP
MHideCurs
PCOPY 2, 0
MShowCurs
MSetRange 1, 1, 640, 200
Tool = 7
IF My > 40 THEN Tool = 70
IF My > 60 THEN Tool = 71
IF My > 80 THEN Tool = 710
LBut = 0: RBut = 0
PrintCoords
ELSE
Tool = 7
END IF
ELSEIF MRange(265, 1, 285, 17, Mx, My) THEN
IF Tool = 8 OR Tool = 80 OR Tool = 81 OR Tool = 810 THEN
MHideCurs
PCOPY 0, 2
Icon 275, 20, 20, 17, ""
GraphColor 0
GPrint "A", 282, 26, 2
Icon 275, 38, 20, 17, "A"
Icon 275, 56, 20, 17, ""
GPrint "A", 282, 60, 2
LINE (282, 68)-(288, 68), 0
Icon 275, 74, 20, 17, "A"
LINE (282, 88)-(289, 88), 0
MShowCurs
MSetRange 275, 20, 295, 92
LBut = 0
DO UNTIL LBut
MButton LBut, RBut, My, Mx, BBut
LOOP
MHideCurs
PCOPY 2, 0
MShowCurs
MSetRange 1, 1, 640, 200
Tool = 8
IF My > 38 THEN Tool = 80
IF My > 56 THEN Tool = 81
IF My > 74 THEN Tool = 810
LBut = 0: RBut = 0
PrintCoords
ELSE
Tool = 8
END IF
ELSEIF MRange(290, 1, 310, 19, Mx, My) THEN
MHideCurs
PCOPY 0, 2
Icon 180, 25, 130, 16, "How many sides?"
Icon 230, 45, 16, 16, ""
Side$ = " "
GLineEdit Side$, 235, 50, 1, 0, KeyCode
WHILE VAL(Side$) < 3: GLineEdit Side$, 235, 50, 1, 0, KeyCode: WEND
PCOPY 2, 0
MShowCurs
Sides = VAL(Side$)
Tool = 9
ELSEIF MRange(315, 1, 335, 19, Mx, My) THEN Tool = 10
ELSEIF MRange(340, 1, 360, 19, Mx, My) THEN Tool = 11
ELSEIF Mx < 40 AND Mx > 0 THEN
FOR Test = 190 TO 40 STEP -10
IF My > Test THEN
IF LBut THEN
FColor = (Test - 40) \ 10
MHideCurs
LINE (1, 21)-(40, 40), BColor, BF
LINE (10, 25)-(30, 35), FColor, BF
MShowCurs
EXIT FOR
ELSEIF RBut THEN
BColor = (Test - 40) \ 10
MHideCurs
LINE (1, 21)-(40, 40), BColor, BF
LINE (10, 25)-(30, 35), FColor, BF
MShowCurs
EXIT FOR
END IF
END IF
NEXT
END IF
END IF
 
IF LBut OR RBut AND Mx > 20 THEN
DrawingTools
END IF
LBut = 0: RBut = 0
 
SELECT CASE Tool
CASE IS <= 10: TTool = Tool
CASE 11: TTool = 1
CASE 80, 81, 810: TTool = 8
CASE 70, 71, 710: TTool = 7
CASE 60: TTool = 6
CASE 50: TTool = 5
END SELECT
IF Mx < 48 OR My < 24 THEN
IF OldTool <> -99 THEN CustomCursor 1
OldTool = -99
ELSE
IF OldTool <> TTool THEN
CustomCursor TTool
END IF
OldTool = TTool
END IF
IF Tool = 11 THEN TTool = 11
 
FOR Count = 0 TO 10
IF TTool = Count + 1 THEN
Clr = 12
ELSE
Clr = 1
END IF
PointX = 89 + (Count * 25)
PointX2 = 89 + (Count * 25) + 22
IF POINT(PointX, 1) <> Clr AND POINT(PointX2, 1) <> Clr THEN
MHideCurs
LINE (PointX, 1)-(PointX2, 20), Clr, B
LINE (PointX - 1, 1)-(PointX2 + 1, 20), Clr, B
MShowCurs
END IF
NEXT
LOOP
 
 
REM $STATIC
SUB CustomCursor (FileNum)
 
DIM reg AS RegType
 
IF FileNum MOD 10 = 0 THEN
File = FileNum \ 10
ELSE
File = FileNum
END IF
OPEN "Cursors.dat" FOR INPUT AS #1
FOR X = 1 TO FileNum
Temp$ = ""
DO UNTIL Temp$ = "CURSORDATA"
LINE INPUT #1, Temp$
LOOP
NEXT
FOR i = 1 TO 32
INPUT #1, Wrd
MMsk$ = MMsk$ + MKI$(Wrd)
NEXT i
INPUT #1, HotX
INPUT #1, HotY
CLOSE #1
 
reg.ax = 9
reg.bx = HotX: reg.cx = HotY
reg.dx = SADD(MMsk$)
CALL Interrupt(&H33, reg, reg)
reg.ax = 1
CALL Interrupt(&H33, reg, reg)
 
END SUB
 
SUB DrawingTools
 
IF My < 24 OR Mx < 48 THEN EXIT SUB
 
MSetRange 47, 24, 639, 199
MHideCurs
PCOPY 0, 3
PCOPY 0, 2: MShowCurs
 
IF LBut THEN
Clr = FColor
Clr2 = BColor
ELSEIF RBut THEN
Clr = BColor
Clr2 = FColor
END IF
GraphColor 0
IF Tool = 50 THEN GraphColor Clr
 
StartX = Mx: StartY = My
SELECT CASE Tool
CASE 2
GraphColor Clr
OldMx = Mx: OldMy = My
DO UNTIL NOT (LBut OR RBut)
IF OldMx <> Mx OR OldMy <> My THEN
MHideCurs
LINE (OldMx, OldMy)-(Mx, My), Clr
MShowCurs
PrintCoords
END IF
OldMx = Mx: OldMy = My
MButton LBut, RBut, My, Mx, BBut
MGetLoc My, Mx
LOOP
GOTO Ending
CASE 3
DO
MButton LBut, RBut, My, Mx, BBut
IF NOT (LBut OR RBut) THEN GOTO Ending
DO UNTIL OldMx <> Mx OR OldMy <> My
MButton LBut, RBut, My, Mx, BBut
MGetLoc My, Mx
IF NOT (LBut OR RBut) THEN GOTO EndSub
LOOP
PrintCoords
OldMx = Mx: OldMy = My: MHideCurs
LINE (Mx + 3, My + 2)-(Mx + 12, My + 11), Clr2, BF
PCOPY 0, 2: MShowCurs
LOOP
CASE 4
MHideCurs
Color1 = 15: Color2 = 0
IF Color2 = FColor THEN Color2 = 10
IF Color1 = BColor THEN Color1 = 12
 
PCOPY 0, 1
SCREEN 8, , 1, 0
FOR X = 47 TO 639
FOR Y = 24 TO 199
IF POINT(X, Y) <> BColor THEN
PSET (X, Y), Color1
ELSE
PSET (X, Y), Color2
END IF
NEXT
NEXT
PAINT (Mx, My), FColor, Color1
 
FOR Y = 24 TO 199
FillString(Y - 24) = SPACE$(592)
FOR X = 47 TO 639
IF POINT(X, Y) = FColor THEN
MID$(FillString(Y - 24), X - 46, 1) = "A"
END IF
NEXT
NEXT
SCREEN 8, , 0, 0
FOR Y = 24 TO 199
FOR X = 47 TO 639
IF MID$(FillString(Y - 24), X - 46, 1) = "A" THEN
PSET (X, Y), FColor
END IF
NEXT
NEXT
MShowCurs
GOTO Ending
CASE 8, 80, 81, 810
GraphColor Clr
IF RBut THEN
SWAP Clr, Clr2
END IF
Txt$ = SPACE$(80)
MHideCurs
GLineEdit Txt$, Mx, My, 2, 0, KeyCode
PCOPY 2, 0
IF KeyCode <> 27 THEN
IF Tool = 80 OR Tool = 810 THEN
GraphColor Clr2
GPrint Txt$, Mx + 1, My + 1, 2
GraphColor Clr
END IF
IF Tool = 81 OR Tool = 810 THEN
LINE (Mx, My + 8)-(Mx + (LEN(RTRIM$(Txt$)) * 8), My + 8), Clr
END IF
GPrint RTRIM$(Txt$), Mx, My, 2
END IF
MShowCurs
GOTO Ending
CASE 10
MSetRange 58, 34, 639, 199
MHideCurs
OMx = Mx: OMy = My
DO UNTIL NOT (LBut OR RBut)
MButton LBut, RBut, My, Mx, BBut
MGetLoc My, Mx
Px = INT(RND * 20) - 10 + Mx
Py = INT(RND * 20) - 10 + My
IF SQR((((Mx - Px) ^ 2) + ((My - Py) ^ 2))) <= 10 THEN PSET (Px, Py), Clr
IF OMx <> Mx OR OMy <> My THEN
PrintCoords
OMx = Mx: OMy = My
END IF
LOOP
MShowCurs
GOTO Ending
CASE 11
MHideCurs
Clr = POINT(Mx, My)
IF LBut THEN
FColor = Clr
ELSE
BColor = Clr
END IF
LINE (1, 21)-(40, 40), BColor, BF
LINE (10, 25)-(30, 35), FColor, BF
MShowCurs
GOTO Ending
END SELECT
 
MShowCurs
DO
MButton LBut, RBut, My, Mx, BBut
IF NOT (LBut OR RBut) THEN GOTO EndSub
OMx = Mx: OMy = My
MHideCurs
IF Tool <> 50 THEN PCOPY 2, 0
SELECT CASE Tool
CASE 5: LINE (StartX, StartY)-(Mx, My), 0
CASE 50: LINE (StartX, StartY)-(Mx, My), 0
CASE 6, 60: LINE (StartX, StartY)-(Mx, My), 0, B
CASE 7, 70
Radius = SQR(((StartX - Mx) ^ 2) + ((StartY - My) ^ 2))
CIRCLE (StartX, StartY), Radius, 0
CASE 71, 710
IF StartX <> Mx THEN
LINE (StartX, StartY)-(Mx, My), 0, B
Radius = ABS(StartX - Mx) / 2
Aspect! = ABS(StartY - My) / ABS(StartX - Mx)
IF Aspect! > 1 THEN Radius = Radius * Aspect!
CIRCLE ((StartX + Mx) \ 2, (StartY + My) \ 2), Radius, 0, , , Aspect!
END IF
CASE 9
IF StartY <> My THEN
Radius = SQR(((StartX - Mx) ^ 2) + ((2 * (StartY - My)) ^ 2))
Degrees = INT(ATN((StartX - Mx) / (StartY - My)) * 57.2958)
DRAW "C0 BM" + STR$(StartX) + "," + STR$(StartY)
FOR Count = 1 TO 360 STEP 360 \ Sides
Temp = Count + Degrees
IF My > StartY THEN Temp = Temp + 180
IF Temp > 360 THEN Temp = Temp - 360
IF Temp < 0 THEN Temp = 360 + Temp
DRAW "TA" + STR$(Temp) + "R" + STR$(Radius)
NEXT
END IF
END SELECT
PrintCoords
MShowCurs
DO UNTIL OMx <> Mx OR OMy <> My
MButton LBut, RBut, My, Mx, BBut
MGetLoc My, Mx
IF NOT (LBut OR RBut) THEN GOTO EndSub
LOOP
LOOP
 
EndSub:
GraphColor Clr
IF RBut THEN GraphColor Clr2
MHideCurs
IF Tool <> 50 THEN PCOPY 2, 0
SELECT CASE Tool
CASE 5: LINE (StartX, StartY)-(Mx, My), Clr
CASE 6: LINE (StartX, StartY)-(Mx, My), Clr, B
CASE 7
Radius = SQR(((StartX - Mx) ^ 2) + ((StartY - My) ^ 2))
CIRCLE (StartX, StartY), Radius, Clr
CASE 60
LINE (StartX, StartY)-(Mx, My), Clr, BF
IF StartX > Mx THEN SWAP StartX, Mx
IF StartY > My THEN SWAP StartY, My
LINE (StartX + 1, StartY + 1)-(Mx - 1, My - 1), Clr2, BF
CASE 70
IF StartX = Mx THEN
MShowCurs
EXIT SUB
END IF
SCREEN 8, , 1, 0
Radius = SQR(((StartX - Mx) ^ 2) + ((StartY - My) ^ 2))
LINE (1, 1)-(640, 200), 15, BF
CIRCLE (StartX, StartY), Radius, 0
PAINT (StartX, StartY), 0, 0
GET (StartX - Radius, StartY - (.5 * Radius))-(StartX + Radius, StartY + (.5 * Radius)), FillArea(26908 - (4 + INT((((StartX - Radius) - (StartX + Radius) + 1) + 7) / 8) * 4 * (((StartY - (.5 * Radius)) - (StartY + (.5 * Radius))) + 1)))
PCOPY 0, 1
PUT (StartX - Radius, StartY - (.5 * Radius)), FillArea(26908 - (4 + INT((((StartX - Radius) - (StartX + Radius) + 1) + 7) / 8) * 4 * (((StartY - (.5 * Radius)) - (StartY + (.5 * Radius))) + 1))), AND
CIRCLE (StartX, StartY), Radius, Clr2
PAINT (StartX, StartY), Clr2, Clr2
CIRCLE (StartX, StartY), Radius, Clr
PCOPY 1, 0
SCREEN 8, , 0, 0
CASE 71
Radius = ABS(StartX - Mx) / 2
Aspect! = ABS(StartY - My) / ABS(StartX - Mx)
IF Aspect! > 1 THEN Radius = Radius * Aspect!
CIRCLE ((StartX + Mx) \ 2, (StartY + My) \ 2), Radius, Clr, , , Aspect!
CASE 710
IF StartX = Mx THEN
MShowCurs
EXIT SUB
END IF
SCREEN 8, , 1, 0
Radius = ABS(StartX - Mx) / 2
Aspect! = ABS(StartY - My) / ABS(StartX - Mx)
IF Aspect! > 1 THEN Radius = Radius * Aspect!
PAINT (1, 1), 15
CIRCLE ((StartX + Mx) \ 2, (StartY + My) \ 2), Radius, 0, , , Aspect!
PAINT ((StartX + Mx) \ 2, (StartY + My) \ 2), 0, 0
IF StartX > Mx THEN
SWAP StartX, Mx
END IF
IF StartY > My THEN
SWAP StartY, My
END IF
GET (StartX - 1, StartY - 1)-(Mx, My), FillArea(26908 - (4 + INT(((Mx - StartX) * (1) + 7) / 8) * 4 * (My - StartY)))
PCOPY 0, 1
PUT (StartX - 1, StartY - 1), FillArea(26908 - (4 + INT(((Mx - StartX) * (1) + 7) / 8) * 4 * (My - StartY))), AND
CIRCLE ((StartX + Mx) \ 2, (StartY + My) \ 2), Radius, Clr2, , , Aspect!
PAINT ((StartX + Mx) \ 2, (StartY + My) \ 2), Clr2, Clr2
CIRCLE ((StartX + Mx) \ 2, (StartY + My) \ 2), Radius, Clr, , , Aspect!
PCOPY 1, 0
CLS
SCREEN 8, , 0, 0
CASE 9
IF StartY <> My THEN
Radius = SQR(((StartX - Mx) ^ 2) + ((2 * (StartY - My)) ^ 2))
Degrees = INT(ATN((StartX - Mx) / (StartY - My)) * 57.2958)
DRAW "C" + LTRIM$(STR$(Clr)) + "BM" + STR$(StartX) + "," + STR$(StartY)
FOR Count = 1 TO 360 STEP 360 \ Sides
Temp = Count + Degrees
IF My > StartY THEN Temp = Temp + 180
IF Temp > 360 THEN Temp = Temp - 360
IF Temp < 0 THEN Temp = 360 + Temp
DRAW "TA" + STR$(Temp) + "R" + STR$(Radius)
NEXT
END IF
END SELECT
MShowCurs
 
Ending:
MShowCurs
MSetRange 1, 1, 639, 199
 
END SUB
 
SUB FileLoad
OPEN FilName$ FOR BINARY ACCESS READ AS #1
FilePos = 0
FOR X = 47 TO 639
Temp = FilePos + 1
Blah$ = " "
DO UNTIL Blah$ = CHR$(13) + CHR$(10)
GET #1, Temp, Blah$
Temp = Temp + 1
LOOP
Temp$ = SPACE$(Temp - FilePos - 2)
GET #1, FilePos + 1, Temp$
FilePos = Temp
 
Y = 23
StringPos = 0
DO UNTIL StringPos >= LEN(Temp$)
Y = Y + 1
StringPos = StringPos + 1
Clr = ASC(MID$(Temp$, StringPos, 1)) - 66
IF Clr = 134 THEN
StringPos = StringPos + 1
Clr = ASC(MID$(Temp$, StringPos, 1)) - 66
StringPos = StringPos + 1
Size = ASC(MID$(Temp$, StringPos, 1))
LINE (X, Y)-(X, Y + Size), Clr
Y = Y + Size' + 1
ELSE
PSET (X, Y), Clr
StringPos = StringPos + 1
END IF
LOOP
NEXT
CLOSE #1
 
END SUB
 
SUB FileSave
PCOPY 0, 2
OPEN FilName$ FOR OUTPUT AS #1
FOR X = 47 TO 639
FOR Y = 24 TO 199
Clr = POINT(X, Y)
IF POINT(X, Y) = Clr AND POINT(X, Y + 1) = Clr AND POINT(X, Y + 3) = Clr AND POINT(X, Y + 4) = Clr THEN
TempY = Y
DO UNTIL POINT(X, TempY) <> Clr
TempY = TempY + 1
LOOP
Temp$ = Temp$ + CHR$(200) + CHR$(Clr + 66) + CHR$(TempY - Y)
Y = TempY
ELSE
Temp$ = Temp$ + CHR$(Clr + 66)
END IF
NEXT
PCOPY 2, 0
LINE (X, 24)-(X, 199), 12
PRINT #1, Temp$
Temp$ = ""
NEXT
CLOSE #1
 
END SUB
 
SUB Icon (X, Y, Wid, High, Title$)
 
LINE (X + 1, Y)-(X + Wid - 1, Y), 15
LINE (X, Y + 1)-(X, Y + High - 1), 15
LINE (X + 1, Y + High)-(X + Wid - 1, Y + High), 8
LINE (X + Wid, Y + 1)-(X + Wid, Y + High - 1), 8
LINE (X + 1, Y + 1)-(X + Wid - 1, Y + High - 1), 7, BF
GraphColor 7
GPrint Title$, X + (Wid \ 2) - (LEN(Title$) * 4) + 2, Y + (High \ 2) - 2, 0
GraphColor 15
GPrint Title$, X + (Wid \ 2) - (LEN(Title$) * 4) + 1, Y + (High \ 2) - 3, 3
 
END SUB
 
SUB InitScreen
 
LINE (44, 22)-(640, 22), BColor
LINE (44, 22)-(44, 200), BColor
PAINT (50, 50), BColor, BColor
PAINT (10, 10), 1, BColor
LINE (42, 21)-(640, 23), 0, BF
LINE (42, 21)-(46, 200), 0, BF
FOR Y = 40 TO 190 STEP 10
LINE (0, Y)-(40, Y + 11), (Y - 20) \ 10 - 2, BF
NEXT
LINE (1, 21)-(40, 40), BColor, BF
LINE (10, 25)-(30, 35), FColor, BF
 
Icon 2, 2, 40, 17, "File"
Icon 45, 2, 43, 17, "Edit"
 
FOR X = 0 TO 10
Icon 90 + (X * 25), 2, 20, 17, ""
IF X > 3 AND X < 9 THEN
LINE (90 + (X * 25) + 16, 16)-(90 + (X * 25) + 18, 16), 0
PSET (90 + (X * 25) + 17, 17), 0
END IF
NEXT
FOR X = 0 TO 3
READ Pic$
PutPic 95 + (X * 25), 6, Pic$
NEXT
READ Pic$
PutPic 320, 6, Pic$
READ Pic$
PutPic 345, 6, Pic$
LINE (196, 8)-(202, 14), 0
LINE (220, 8)-(228, 14), 0, B
CIRCLE (250, 11), 4, 0, , , 1
Icon 265, 2, 20, 17, "A"
LINE (281, 16)-(283, 16), 0
PSET (282, 17), 0
Icon 290, 2, 20, 17, "P"
LINE (306, 16)-(308, 16), 0
PSET (307, 17), 0
 
LINE (545, 2)-(640, 19), 15, BF
Mx = 320: My = 100: OMx = 320: OMy = 100
GraphColor 0
GPrint "X=", 553, 8, 2
GPrint "Y=", 596, 8, 2
GPrint STR$(Mx), 562, 8, 2
GPrint STR$(My), 605, 8, 2
 
END SUB
 
FUNCTION MRange (x0, y0, X1, Y1, Mx, My)
 
IF My < Y1 AND My > y0 AND Mx > x0 AND Mx < X1 THEN MRange = -1
 
END FUNCTION
 
SUB PrintCoords
 
GraphColor 0
LINE (545, 2)-(640, 19), 15, BF
GPrint "X=", 553, 8, 2
GPrint "Y=", 596, 8, 2
GPrint STR$(Mx - 47), 562, 8, 2
GPrint STR$(My - 24), 605, 8, 2
 
END SUB
 
SUB PutPic (X, Y, Pic$)
 
Temp = 0
FOR TempY = 1 TO 8
FOR TempX = 1 TO 8
Temp = Temp + 1
PSET (TempX + X, TempY + Y), ASC(MID$(Pic$, Temp, 1)) - 65
NEXT
NEXT
 
END SUB
 
SUB TeaseScreen
 
LINE (100, 50)-(100, 100), 0
LINE (110, 55)-(110, 95), 0
CIRCLE (110, 75), 48, 0, 1.5 * Pi, .5 * Pi
CIRCLE (100, 75), 66, 0, 1.5 * Pi, .5 * Pi, .4
PAINT (105, 53), 12, 0
 
CIRCLE (220, 65), 40, 0
CIRCLE (220, 65), 30, 0
PAINT (185, 65), 12, 0
CIRCLE (280, 95), 40, 0
CIRCLE (280, 95), 30, 0
PAINT (245, 95), 12, 0
LINE (330, 50)-(330, 100), 0
LINE (340, 55)-(340, 95), 0
CIRCLE (340, 75), 48, 0, 1.5 * Pi, .5 * Pi
CIRCLE (330, 75), 66, 0, 1.5 * Pi, .5 * Pi, .4
PAINT (345, 53), 12, 0
 
LINE (400, 50)-(400, 100), 0
LINE (400, 100)-(470, 100), 0
LINE (470, 100)-(470, 95), 0
LINE (470, 95)-(410, 95), 0
LINE (410, 95)-(410, 50), 0
LINE (410, 50)-(400, 50), 0
PAINT (405, 55), 12, 0
 
LINE (490, 50)-(490, 100), 0
LINE (490, 100)-(560, 100), 0
LINE (560, 100)-(560, 95), 0
LINE (560, 95)-(500, 95), 0
LINE (500, 95)-(500, 80), 0
LINE (500, 80)-(545, 80), 0
LINE (545, 80)-(545, 75), 0
LINE (545, 75)-(500, 75), 0
LINE (500, 75)-(500, 55), 0
LINE (500, 55)-(560, 55), 0
LINE (560, 55)-(560, 50), 0
LINE (560, 50)-(490, 50), 0
PAINT (495, 55), 12, 0
 
Temp$ = "By Tony Lieuallen"
FOR X = 1 TO LEN(Temp$)
GraphColor X MOD 7
GPrint MID$(Temp$, X, 1), 190 + 8 * X, 120, 2
NEXT
Temp$ = "Freeware notice..."
FOR X = 1 TO LEN(Temp$)
GraphColor X MOD 7
GPrint MID$(Temp$, X, 1), 200 + 8 * X, 140, 2
NEXT
Temp$ = "this is completely free!"
FOR X = 1 TO LEN(Temp$)
GraphColor X MOD 7
GPrint MID$(Temp$, X, 1), 240 + 8 * X, 150, 2
NEXT
 
X = 0: Y = 11
FOR Temp = 1 TO 2
FOR Temp2 = 0 TO 360
IF INKEY$ = "5" THEN EXIT SUB
LINE (220, 65)-(220 + X, 65 + Y), 15
LINE (280, 95)-(280 + X, 95 + Y), 15
X = SIN(Temp2 * (Pi / 180)) * 57.2958 * .5
Y = COS(Temp2 * (Pi / 180)) * 57.2958 * .2
LINE (220, 65)-(220 + X, 65 + Y), 0
LINE (280, 95)-(280 + X, 95 + Y), 0
FOR Temp3 = 1 TO 3000: NEXT
NEXT
NEXT
LINE (220, 65)-(220 + X, 65 + Y), 0
LINE (280, 95)-(280 + X, 95 + Y), 0
 
MShowCurs
Icon 150, 100, 20, 16, "Ok"
MSetLoc 108, 160
LBut = 0
DO UNTIL LBut AND MRange(150, 100, 170, 116, Mx, My)
MButton LBut, RBut, My, Mx, BBut
LOOP
MHideCurs
 
END SUB

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.