Struct rustty_oxide::Canvas [] [src]

pub struct Canvas { /* fields omitted */ }

Logical clone of Frame that exposes backend functionality for users without breaking the API rules

Examples

Be careful when using this code, it's not being tested!
use oxide::Canvas;

let mut canvas = Canvas::new(60, 10);

let (rows, cols) = canvas.size();
// Set the entire canvas to '-' character
for i in 0..cols*rows {
    let y = i / cols;
    let x = i % cols;
    let mut cell = canvas.get_mut(x, y).unwrap();
    cell.set_ch('-');
}

Methods

impl Canvas
[src]

[src]

Constructs a new Canvas object cols wide by rows high

Examples

use oxide::Canvas;

let mut canvas = Canvas::new(60, 10); 

[src]

Returns the size of the canvas

Examples

use oxide::Canvas;

let mut canvas = Canvas::new(60, 10);

assert_eq!(canvas.size(), (60, 10));

[src]

Returns a reference to the vector of cells that lie within the canvas

[src]

Returns a mutable reference to the vector of cells that lie within the canvas

[src]

Clears the canvas with a blank Cell

[src]

Converts a position on the screen to the relative coordinate within the Canvas cell buffer

[src]

Returns a reference to the cell at the specified position (x,*y*), in the form of an Option. If no cell exists at that position, then None

[src]

Returns a mutable reference to the cell at the specified position (x, y), in the form of an Option. If no cell exists at that position, then None

[src]

The location of the canvas

[src]

Mantually sets the location of the canvas

Trait Implementations

impl Widget for Canvas
[src]

[src]

Draws the widget to the valid CellAccessor passed

[src]

Aligns the widget with the parent as reference

[src]

Resize the given widget to new dimensions given by Size

[src]

Expose the painter trait draw_box for all widgets, which outlines the space enclosed within the widget Read more

[src]

Return a reference the renderer, Base in general cases

[src]

Return a mutable reference to the renderer, Base in general cases