Crate turtle [−] [src]
The API Documentation below will help you learn about the various things you can do with this library.
If this is your first time using Rust or using this library, read the Guide on turtle.rs to learn how to start.
The Turtle
struct documentation contains information about the various
things you can do with the Turtle
instances you create. The color
module
and its submodules contain hundreds of constants that you can use as color values.
As a convenience, you can use the color name listed with each constant in a string instead of the
constant itself. See that module for more information about how to use different colors.
Random Values
See the rand
module for information about generating random values which
can be used in your programs.
Event Handling
For advanced users, the Event
enum documentation provides information
about how you can create an event loop. This allows you to draw things in response to
certain events like the mouse moving, keys being pressed, and more.
The Turtle
struct contains a few convenience methods so you can do some common event-related
things without creating the entire event loop. For example, use
wait_for_click()
to wait for the user to click
anywhere on the screen before proceeding.
Reexports
pub use color::Color; |
pub use event::Event; |
pub use rand::random_range; |
Modules
color |
Color types and constants |
event |
Event handling (mouse, keyboard, controller, touch screen, etc.) |
rand |
Utilities for generating random values |
Structs
Turtle |
A turtle with a pen attached to its tail |
Enums
Speed |
Represents the supported movement and rotation speeds |
Functions
random |
Generates a random value using the thread-local random number generator. |
Type Definitions
Angle |
An angle value without a unit |
Distance |
Any distance value (positive or negative) |
Point |
A point in 2D space: [x, y] |