gotuga

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: LGPL-2.1 Imports: 7 Imported by: 0

README

GoTuga

A Turtle-Like Library For Go.
I made it since I like Creative Coding, and gg By fogle man seems to be the only Library that really POPS in Ease of usage.
And so EXISTS GoTuga!

Documentation

You can Find the Documentation Here

Setup

go get github.com/Z6dev/GoTuga
drawing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Turtle

type Turtle struct {
	W, H int
	// contains filtered or unexported fields
}

func New

func New(W, H int, bg color.Color) *Turtle

New creates a new turtle with a W×H canvas and a background color. The turtle starts at (0,0) facing 0° (east), pen down, black ink, width 2px.

func (*Turtle) Backward

func (t *Turtle) Backward(d float64)

Move Backwards by (d) Steps

func (*Turtle) BeginFill

func (t *Turtle) BeginFill()

BeginFill starts recording a polygon fill path

func (*Turtle) Circle

func (t *Turtle) Circle(r float64)

Circle draws an approximate circle with radius r using small segments.

func (*Turtle) Clear

func (t *Turtle) Clear()

Clear repaints the canvas with the background color but keeps turtle state.

func (*Turtle) EndFill

func (t *Turtle) EndFill()

EndFill fills the collected polygon

func (*Turtle) FillColor

func (t *Turtle) FillColor(c color.Color)

FillColor sets the fill color

func (*Turtle) Forward

func (t *Turtle) Forward(d float64)

Move Forward by (d) Steps

func (*Turtle) GoTo

func (t *Turtle) GoTo(x, y float64)

GoTo moves to logical coords (x,y). If pen is down, draws a segment.

func (*Turtle) Home

func (t *Turtle) Home()

Go To (0, 0) and Reset Direction to 0 Degrees, Keeps the Canvas state.

func (*Turtle) Image

func (t *Turtle) Image() *image.RGBA

Image returns the underlying RGBA canvas (read/write).

func (*Turtle) Left

func (t *Turtle) Left(deg float64)

Turn Left (deg) Degrees

func (*Turtle) PenDown

func (t *Turtle) PenDown()

Stops Drawing Mode of Turtle

func (*Turtle) PenUp

func (t *Turtle) PenUp()

Starts Drawing Mode of Turtle

func (*Turtle) Polygon

func (t *Turtle) Polygon(n int, side float64)

Polygon draws an n-sided regular polygon with side length s.

func (*Turtle) Rect

func (t *Turtle) Rect(w, h float64)

Shapes (drawn at current position/orientation)

func (*Turtle) Reset

func (t *Turtle) Reset()

Reset clears the canvas and resets position/orientation/pen to defaults.

func (*Turtle) Right

func (t *Turtle) Right(deg float64)

Turn Right (deg) Degrees

func (*Turtle) SavePNG

func (t *Turtle) SavePNG(filename string) error

SavePNG writes the current canvas to a PNG file.

func (*Turtle) SetColor

func (t *Turtle) SetColor(c color.Color)

Set pen Color to color.Color type from "image/color" package

func (*Turtle) SetHeading

func (t *Turtle) SetHeading(deg float64)

Set Turtle's Rotation towards (deg) Degrees

func (*Turtle) SetWidth

func (t *Turtle) SetWidth(w float64)

Sets the Thickness or Width of the Pen

Directories

Path Synopsis
cmd
demo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL