pub struct SimpleConsole {
    pub width: u32,
    pub height: u32,
    pub tiles: Vec<Tile>,
    pub is_dirty: bool,
    pub offset_x: f32,
    pub offset_y: f32,
    pub scale: f32,
    pub scale_center: (i32, i32),
    pub extra_clipping: Option<Rect>,
    pub translation: CharacterTranslationMode,
    /* private fields */
}
Expand description

A simple console with background color.

Fields

width: u32height: u32tiles: Vec<Tile>is_dirty: booloffset_x: f32offset_y: f32scale: f32scale_center: (i32, i32)extra_clipping: Option<Rect>translation: CharacterTranslationMode

Implementations

Initializes a console, ready to add to BTerm’s console list.

Trait Implementations

Translate an x/y into an array index.

Clears the screen.

Clears the screen with a background color.

Prints a string at x/y.

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

Sets a single cell in the console

Sets a single cell in the console’s background

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

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

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

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

Fills a rectangle with the specified rendering information

Draws a horizontal progress bar

Draws a vertical progress bar

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

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

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

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

Prints text right-aligned

Prints colored text right-aligned

Print a colorized string with the color encoding defined inline. For example: printer(1, 1, “#[blue]This blue text contains a #[pink]pink#[] word”) You can get the same effect with a TextBlock, but this can be easier. Thanks to doryen_rs for the idea.

Saves the layer to an XpFile structure

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.

Permits the creation of an arbitrary clipping rectangle. It’s a really good idea to make sure that this rectangle is entirely valid.

Returns the current arbitrary clipping rectangle, None if there isn’t one.

Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).

Sets ALL tiles background alpha (only tiles that exist, in sparse consoles).

Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).

Sets the character translation mode

Sets the character size of the terminal

Gets the dimensions of the console in characters
Specify a scale and center of the console. A scale above 1.0 will make the text larger. The center of the scale is at character position (center_x, center_y). Read more
Get the scale & center of the console. Returns (scale, center_x, center_y). Read more
Produces the implementor as an Any that can be matched to determine type and access natively. Read more
Produces the implementor as an Any that can be matched to determine type and access natively. Read more
Returns true if an x/y coordinate is within the console bounds
Try to use a coordinate: return Some(the coordinate) if it is valid, None if it isn’t. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.