Documentation ¶
Index ¶
Constants ¶
View Source
const ( East = 0.0 North = 90.0 West = 180.0 South = 270.0 )
Standard directions.
Variables ¶
View Source
var ( Black = color.RGBA{0, 0, 0, 255} SoftBlack = color.RGBA{10, 10, 10, 255} White = color.RGBA{255, 255, 255, 255} Red = color.RGBA{255, 0, 0, 255} Green = color.RGBA{0, 255, 0, 255} Blue = color.RGBA{0, 0, 255, 255} Cyan = color.RGBA{0, 255, 255, 255} Magenta = color.RGBA{255, 0, 255, 255} Yellow = color.RGBA{255, 255, 0, 255} // I just love this one DarkOrange = color.RGBA{150, 75, 0, 255} )
Standard colors.
Functions ¶
Types ¶
type Pen ¶
type Pen struct { Color color.Color // Line color. Size int // Line width. On bool // State of the Pen. }
A simple Pen.
type Turtle ¶
A minimal Turtle agent, moving on a cartesian plane.
type TurtleDraw ¶
type TurtleDraw struct { Turtle // Turtle agent to move around. Pen // Pen used when drawing. W *World // World to draw on. }
A drawing Turtle.
func NewTurtleDraw ¶
func NewTurtleDraw(w *World) *TurtleDraw
Create a new TurtleDraw, attached to the World w.
func (*TurtleDraw) Backward ¶
func (td *TurtleDraw) Backward(dist float64)
Move the turtle backward and draw the line if the Pen is On.
func (*TurtleDraw) Forward ¶
func (td *TurtleDraw) Forward(dist float64)
Move the turtle forward and draw the line if the Pen is On.
func (*TurtleDraw) SetPos ¶
func (td *TurtleDraw) SetPos(x, y float64)
Teleport the Turtle to (x, y) and draw the line if the Pen is On.
type World ¶
type World struct { Image *image.RGBA Width, Height int DrawLineCh chan Line // contains filtered or unexported fields }
A world to draw on.
func NewWorldImage ¶
Create a new World attached to the Image img, and start listening on w.DrawLineCh for lines to draw.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.