Struct drawille::Turtle [] [src]

pub struct Turtle {
    pub x: f32,
    pub y: f32,
    pub brush: bool,
    pub rotation: f32,
    pub cvs: Canvas,
}

A ‘turtle’ that can walk around a canvas drawing lines.

Fields

Methods

impl Turtle
[src]

Create a new Turtle, starting at the given coordinates.

The turtle starts with its brush down, facing right.

Creates a new Turtle with the provided Canvas, starting at the given coordinates.

The turtle starts with its brush down, facing right.

Sets the width of a Turtle’s Canvas, and return it for use again.

Sets the height of a Turtle’s Canvas, and return it for use again.

Lifts the Turtle’s brush.

Puts down the Turtle’s brush.

Toggles the Turtle’s brush.

Moves the Turtle forward by dist steps.

Moves the Turtle backward by dist steps.

Teleports the Turtle to the given coordinates.

Note that this draws a line between the old position and the new one if the Turtle’s brush is down.

Turns the Turtle right (clockwise) by angle degrees.

Turns the Turtle left (clockwise) by angle degrees.

Writes the Turtle’s Canvas to a String and returns it.