Shape Maker
#1
Now that I'm learning degrees, I decided to make a shape maker today. You type in how many sides you want, from 3 to 100 and what basic color (15 to choose from) you want and if you want it filled-in or not. Then it makes the shape. It makes it with a white background so you can press C to copy it to the clipboard and paste it to your favorite graphics program.


[Image: Shape-Maker-by-Sierra-Ken.jpg]

 

Code: (Select All)
Dim img As Long
Dim cl As Long
Screen _NewImage(800, 600, 32)
start:
_Title "Shape Maker by SierraKen"
x = 400
y = 300
fill = 0
Cls
again:
Print: Print: Print
Input "Number Of Sides (3-100): ", sides
If sides > 100 Then Print "Too many, type between 3 to 100.": GoTo again:
If sides < 3 Then Print "Too few, type between 3 to 100.": GoTo again:
again2:
Print
Print "(1) Red"
Print "(2) Green"
Print "(3) Blue"
Print "(4) Purple"
Print "(5) Pink"
Print "(6) Orange"
Print "(7) Brown"
Print "(8) Gray"
Print "(9) Black"
Print "(10) Yellow"
Print "(11) Sky Blue"
Print "(12) Tan"
Print "(13) Light Green"
Print "(14) Light Red"
Print "(15) Dark Yellow"
Print
Input "Type color here (1-15): ", c
If c < 1 Or c > 15 Or Int(c) <> c Then Print "Type 1-15 only, without decimals.": GoTo again2:
If c = 1 Then cl = _RGB32(255, 0, 0)
If c = 2 Then cl = _RGB32(0, 255, 0)
If c = 3 Then cl = _RGB32(0, 0, 255)
If c = 4 Then cl = _RGB32(188, 0, 255)
If c = 5 Then cl = _RGB32(255, 0, 255)
If c = 6 Then cl = _RGB32(255, 122, 0)
If c = 7 Then cl = _RGB32(183, 83, 0)
If c = 8 Then cl = _RGB32(127, 127, 127)
If c = 9 Then cl = _RGB32(0, 0, 0)
If c = 10 Then cl = _RGB32(255, 255, 0)
If c = 11 Then cl = _RGB32(0, 255, 255)
If c = 12 Then cl = _RGB32(222, 150, 127)
If c = 13 Then cl = _RGB32(89, 255, 0)
If c = 14 Then cl = _RGB32(255, 0, 83)
If c = 15 Then cl = _RGB32(255, 188, 67)
Print
Input "Do you wish to have the shape filled in (Y/N)"; yn$
If Left$(yn$, 1) = "y" Or Left$(yn$, 1) = "Y" Then fill = 1
Cls
_Title "Shape Maker - C copies to clipboard, Space Bar starts over, Esc quits"
Paint (0, 0), _RGB32(255, 255, 255)
st = 360 / sides
For deg = 0 To 360 Step st
    deg2 = 90 + deg
    'Plot 300 points with equations.
    oldx = x
    oldy = y
    For t = 1 To 800 / sides Step .25
        x = (Sin(_D2R(deg2)) * t) + oldx
        y = (Cos(_D2R(deg2)) * t) + oldy
        Circle (x - 400 / sides, y), 1, cl
    Next t
Next deg
If fill = 1 Then Paint (400, 250), cl

Do
    a$ = InKey$
    If a$ = Chr$(27) Then End
    If a$ = " " Then GoTo start:
    If a$ = "c" Or a$ = "C" Then
        If img <> 0 Then _FreeImage (img&)
        img& = _CopyImage(0)
        _ClipboardImage = img&
        Locate 1, 1: Print "Image Copied To Clipboard."
    End If
Loop
Reply


Messages In This Thread
Shape Maker - by SierraKen - 07-11-2022, 06:29 PM
RE: Shape Maker - by bplus - 07-11-2022, 10:07 PM
RE: Shape Maker - by vince - 07-13-2022, 04:56 AM
RE: Shape Maker - by SierraKen - 07-12-2022, 12:13 AM
RE: Shape Maker - by bplus - 07-13-2022, 01:16 PM
RE: Shape Maker - by SierraKen - 07-13-2022, 07:06 PM
RE: Shape Maker - by bplus - 07-13-2022, 10:07 PM
RE: Shape Maker - by SierraKen - 07-14-2022, 02:35 AM



Users browsing this thread: 7 Guest(s)