Module rurtle::graphic
[−]
[src]
This is the backend for turtle graphics. It's a wrapper around glium, dealing with shaders etc. and providing a few high-level methods upon which turtles can be built.
The Coordinate grid
Unlike in other graphic libraries, the origin (0, 0) is in the middle of the whole canvas. Positive x/y coordinates go right/up and negative ones left/down. The canvas does have as many pixels as the window size, thus it is possible to increase the section shown by resizing the window. Scrolling and zooming are currently not supported.
Drawing and events
To stay flexible, TurtleScreen
has no built-in event loop. To redraw the
screen, use the draw_and_update
-function. To handle events such as mouse
clicks, use handle_events
.
Example
let mut screen = TurtleScreen::new((640, 480), "Rurtle"); screen.add_line((0.0, 0.0), (50.0, 50.0), color::BLACK); screen.turtle_position = (50.0, 50.0); screen.turtle_orientation = 315.0; screen.draw_and_update();
Modules
color |
Module for color aliases |
Structs
TurtleScreen |
A |