Module rurtle::turtle [] [src]

This module contains the actual implementation of the turtle concept.

The Turtle starts in the middle of the screen and can be given commands such as forward(100) or left(90). While moving across the screen, the turtle draws its path on the canvas. Based on this primitive movements, you can build more complex commands and draw nice patterns.

A Turtle always has a TurtleScreen owned. This TurtleScreen must be given to Turtle::new()

Example

use rurtle::graphic::TurtleScreen;
use rurtle::turtle::Turtle;
let screen = TurtleScreen::new((640, 480), "Turtle Demo");
let mut turtle = Turtle::new(screen);
for _ in (0..4) {
    turtle.forward(100.0);
    turtle.right(90.0);
}

Structs

Turtle

The Turtle struct is the thing that actually provides the methods to walk on the screen