Struct rurtle::graphic::TurtleScreen [] [src]

pub struct TurtleScreen {
    pub turtle_position: (f32, f32),
    pub turtle_color: Color,
    pub turtle_orientation: f32,
    pub turtle_hidden: bool,
    pub background_color: Color,
    // some fields omitted
}

A TurtleScreen is a window that houses a turtle. It provides some graphic methods, but you should use a Turtle instead.

Fields

turtle_position

The position of the turtle on the canvas

turtle_color

The color of the turtle

turtle_orientation

The orientation of the turtle in degrees where 0° is north and positive degrees count counter-clockwise

turtle_hidden

If this is set to true, the turtle itself won't be drawn

background_color

Background color of the turtle screen

Methods

impl TurtleScreen

fn new(size: (u32, u32), title: &str) -> TurtleScreen

Create a new TurtleScreen with the given size and window title.

Panics

Panics if something in the underlaying glium window creation fails.

fn add_line(&mut self, start: (f32, f32), end: (f32, f32), color: Color)

Add a line to the collection, going from point start to point end

fn add_text(&mut self, anchor: (f32, f32), angle: f32, color: Color, text: &str)

Add a new text to the screen

fn floodfill(&mut self, point: (f32, f32), color: Color)

Floodfill the image at the given point with the given color

fn clear(&mut self)

Remove all drawn lines. Note that this does not change the turtle's position, color or orientation.

fn draw_and_update(&self)

Draw everything and update the screen

fn handle_events(&mut self)

Poll the window's events and handle them

fn is_closed(&self) -> bool

Return if the window has been closed. A closed window can only be detected if the window's events have been handled. Thus it is advised to use handle_events() before checking is_closed().

fn screenshot(&self) -> DynamicImage

Return the current screen as an image