[]Trait rltk::console::Console

pub trait Console {
    fn rebuild_if_dirty(&mut self, platform: &BTermPlatform);
fn get_char_size(&self) -> (u32, u32);
fn resize_pixels(&mut self, width: u32, height: u32);
fn gl_draw(
        &mut self,
        font: &Font,
        shader: &Shader,
        platform: &BTermPlatform
    );
fn at(&self, x: i32, y: i32) -> usize;
fn cls(&mut self);
fn cls_bg(&mut self, background: RGB);
fn print(&mut self, x: i32, y: i32, output: &str);
fn print_color(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, output: &str);
fn set(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, glyph: u8);
fn set_bg(&mut self, x: i32, y: i32, bg: RGB);
fn draw_box(
        &mut self,
        x: i32,
        y: i32,
        width: i32,
        height: i32,
        fg: RGB,
        bg: RGB
    );
fn draw_hollow_box(
        &mut self,
        x: i32,
        y: i32,
        width: i32,
        height: i32,
        fg: RGB,
        bg: RGB
    );
fn draw_box_double(
        &mut self,
        x: i32,
        y: i32,
        width: i32,
        height: i32,
        fg: RGB,
        bg: RGB
    );
fn draw_hollow_box_double(
        &mut self,
        x: i32,
        y: i32,
        width: i32,
        height: i32,
        fg: RGB,
        bg: RGB
    );
fn fill_region(&mut self, target: Rect, glyph: u8, fg: RGB, bg: RGB);
fn get(&self, x: i32, y: i32) -> Option<(&u8, &RGB, &RGB)>;
fn draw_bar_horizontal(
        &mut self,
        x: i32,
        y: i32,
        width: i32,
        n: i32,
        max: i32,
        fg: RGB,
        bg: RGB
    );
fn draw_bar_vertical(
        &mut self,
        x: i32,
        y: i32,
        height: i32,
        n: i32,
        max: i32,
        fg: RGB,
        bg: RGB
    );
fn print_centered(&mut self, y: i32, text: &str);
fn print_color_centered(&mut self, y: i32, fg: RGB, bg: RGB, text: &str);
fn to_xp_layer(&self) -> XpLayer;
fn set_offset(&mut self, x: f32, y: f32);
fn set_scale(&mut self, scale: f32, center_x: i32, center_y: i32);
fn as_any(&self) -> &(dyn Any + 'static); fn in_bounds(&self, x: i32, y: i32) -> bool { ... }
fn try_at(&self, x: i32, y: i32) -> Option<usize> { ... } }

Trait that must be implemented by console types.

Required methods

fn rebuild_if_dirty(&mut self, platform: &BTermPlatform)

Check to see if the internal OpenGL representation needs to be rebuilt, and do so if required.

fn get_char_size(&self) -> (u32, u32)

Gets the dimensions of the console in characters

fn resize_pixels(&mut self, width: u32, height: u32)

fn gl_draw(&mut self, font: &Font, shader: &Shader, platform: &BTermPlatform)

Tells the console to draw itself via OpenGL.

fn at(&self, x: i32, y: i32) -> usize

Converts an x/y coordinate to a console index number.

fn cls(&mut self)

Clear the console.

fn cls_bg(&mut self, background: RGB)

Clear the console to a set background color, if supported.

fn print(&mut self, x: i32, y: i32, output: &str)

Print a string at the specified x/y coordinate.

fn print_color(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, output: &str)

Print a string in color at the specified x/y coordinate, with specified foreground and background.

fn set(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, glyph: u8)

Sets a single cell to a color/glyph combination.

fn set_bg(&mut self, x: i32, y: i32, bg: RGB)

Sets a single cell's background color.

fn draw_box(
    &mut self,
    x: i32,
    y: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters

fn draw_hollow_box(
    &mut self,
    x: i32,
    y: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters, without filling in the middle

fn draw_box_double(
    &mut self,
    x: i32,
    y: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters

fn draw_hollow_box_double(
    &mut self,
    x: i32,
    y: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters, without filling in the middle

fn fill_region(&mut self, target: Rect, glyph: u8, fg: RGB, bg: RGB)

Fills a rectangle-defined region with a given glyph

fn get(&self, x: i32, y: i32) -> Option<(&u8, &RGB, &RGB)>

Retrieve a given cell in the console, if present

fn draw_bar_horizontal(
    &mut self,
    x: i32,
    y: i32,
    width: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a horizontal progress bar.

fn draw_bar_vertical(
    &mut self,
    x: i32,
    y: i32,
    height: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a vertical progress bar.

fn print_centered(&mut self, y: i32, text: &str)

Prints text, centered to the whole console width, at vertical location y.

fn print_color_centered(&mut self, y: i32, fg: RGB, bg: RGB, text: &str)

Prints text in color, centered to the whole console width, at vertical location y.

fn to_xp_layer(&self) -> XpLayer

Serializes the console layer to an XpFile

fn set_offset(&mut self, x: f32, y: f32)

Specify a global offset (by character count, so 0.5 is half a character). Useful for drawing walls between tiles.

fn set_scale(&mut self, scale: f32, center_x: i32, center_y: i32)

Specify a scale of the scale. A scale above 1.0 will make the text larger. The center of the scale is at character position (center_x, center_y).

fn as_any(&self) -> &(dyn Any + 'static)

Loading content...

Provided methods

fn in_bounds(&self, x: i32, y: i32) -> bool

fn try_at(&self, x: i32, y: i32) -> Option<usize>

Loading content...

Implementors

impl Console for BTerm

impl Console for SimpleConsole

fn rebuild_if_dirty(&mut self, platform: &BTermPlatform)

Check if the console has changed, and if it has rebuild the backing buffer.

fn gl_draw(&mut self, font: &Font, shader: &Shader, platform: &BTermPlatform)

Sends the console to OpenGL.

fn at(&self, x: i32, y: i32) -> usize

Translate an x/y into an array index.

fn cls(&mut self)

Clears the screen.

fn cls_bg(&mut self, background: RGB)

Clears the screen with a background color.

fn print(&mut self, x: i32, y: i32, output: &str)

Prints a string at x/y.

fn print_color(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, output: &str)

Prints a string at x/y, with foreground and background colors.

fn set(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, glyph: u8)

Sets a single cell in the console

fn set_bg(&mut self, x: i32, y: i32, bg: RGB)

Sets a single cell in the console's background

fn draw_box(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters

fn draw_hollow_box(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters

fn draw_box_double(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters

fn draw_hollow_box_double(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters

fn fill_region(&mut self, target: Rect, glyph: u8, fg: RGB, bg: RGB)

Fills a rectangle with the specified rendering information

fn get(&self, x: i32, y: i32) -> Option<(&u8, &RGB, &RGB)>

Gets the content of a cell

fn draw_bar_horizontal(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a horizontal progress bar

fn draw_bar_vertical(
    &mut self,
    sx: i32,
    sy: i32,
    height: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a vertical progress bar

fn print_centered(&mut self, y: i32, text: &str)

Prints text, centered to the whole console width, at vertical location y.

fn print_color_centered(&mut self, y: i32, fg: RGB, bg: RGB, text: &str)

Prints text in color, centered to the whole console width, at vertical location y.

fn to_xp_layer(&self) -> XpLayer

Saves the layer to an XpFile structure

fn set_offset(&mut self, x: f32, y: f32)

Sets an offset to total console rendering, useful for layers that draw between tiles. Offsets are specified as a percentage of total character size; so -0.5 will offset half a character to the left/top.

impl Console for SparseConsole

fn rebuild_if_dirty(&mut self, platform: &BTermPlatform)

If the console has changed, rebuild the vertex buffer.

fn gl_draw(&mut self, font: &Font, shader: &Shader, platform: &BTermPlatform)

Draws the console to OpenGL.

fn at(&self, x: i32, y: i32) -> usize

Translates x/y to an index entry. Not really useful.

fn cls(&mut self)

Clear the screen.

fn cls_bg(&mut self, _background: RGB)

Clear the screen. Since we don't HAVE a background, it doesn't use it.

fn print(&mut self, x: i32, y: i32, output: &str)

Prints a string to an x/y position.

fn print_color(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, output: &str)

Prints a string to an x/y position, with foreground and background colors.

fn set(&mut self, x: i32, y: i32, fg: RGB, bg: RGB, glyph: u8)

Sets a single cell in the console

fn set_bg(&mut self, x: i32, y: i32, bg: RGB)

Sets a single cell in the console's background

fn draw_box(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters

fn draw_box_double(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters

fn draw_hollow_box(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 line characters

fn draw_hollow_box_double(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    height: i32,
    fg: RGB,
    bg: RGB
)

Draws a box, starting at x/y with the extents width/height using CP437 double line characters

fn fill_region(&mut self, target: Rect, glyph: u8, fg: RGB, bg: RGB)

Fills a rectangle with the specified rendering information

fn draw_bar_horizontal(
    &mut self,
    sx: i32,
    sy: i32,
    width: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a horizontal progress bar

fn draw_bar_vertical(
    &mut self,
    sx: i32,
    sy: i32,
    height: i32,
    n: i32,
    max: i32,
    fg: RGB,
    bg: RGB
)

Draws a vertical progress bar

fn print_centered(&mut self, y: i32, text: &str)

Prints text, centered to the whole console width, at vertical location y.

fn print_color_centered(&mut self, y: i32, fg: RGB, bg: RGB, text: &str)

Prints text in color, centered to the whole console width, at vertical location y.

fn to_xp_layer(&self) -> XpLayer

Saves the layer to an XpFile structure

fn set_offset(&mut self, x: f32, y: f32)

Sets an offset to total console rendering, useful for layers that draw between tiles. Offsets are specified as a percentage of total character size; so -0.5 will offset half a character to the left/top.

Loading content...