Skip to content

Instantly share code, notes, and snippets.

@mimetaur
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save mimetaur/11183868 to your computer and use it in GitHub Desktop.

Select an option

Save mimetaur/11183868 to your computer and use it in GitHub Desktop.
Nathan's Simple Drawing Language for SFPC
# FYI these are comments
# Influences
# http://structuresynth.sourceforge.net/index.php - EigenScript
# http://sass-lang.com/guide - Sass
square is # everything "is" - there is no "run" or "do"
rectangle # this square is a rectangle. this means it uses a rectangle's rules for drawing
width 400 # like width
height 400 # and height. we have to specify both because it's a rectangle, square is just its name
location (0, 0) # it's at 0, 0 in the top left corner of the screen
color white # white is a magic word that equals a red of 1, green of 1, and blue of 1
from top left # draw from (or anchor at) the top left
fill
off # don't fill the shape. this is the default so it does not appear below
# we could also have done
# square is
# square
# width 400 # only need a width in this case
circle is
ellipse # this circle is an ellipse. it uses an ellipse's rules to draw
size (250, 250) # this is another way of showing height and width aka (width, height)
location (125, 125)
color (1, 1, 1) # this is another way of showing a color (red, green, blue)
from center # this shape is anchored at the center. this is the default
# we could also have done
# circle is
# circle
# radius 350
triangle is
shape # shapes are just a series of points. the language figures out drawing the sides
3 points # a shape has X points
(100, 100)
(125, 150)
(150, 100) # no need for width or height, it's implicit in the locations of the points
color # this is another way of showing a color
1 # red
1 # green
1 # blue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment