pub struct BTerm {
Show 19 fields pub width_pixels: u32, pub height_pixels: u32, pub original_height_pixels: u32, pub original_width_pixels: u32, pub fps: f32, pub frame_time_ms: f32, pub active_console: usize, pub key: Option<VirtualKeyCode>, pub mouse_pos: (i32, i32), pub left_click: bool, pub shift: bool, pub control: bool, pub alt: bool, pub web_button: Option<String>, pub quitting: bool, pub post_scanlines: bool, pub post_screenburn: bool, pub screen_burn_color: RGB, pub mouse_visible: bool,
}
Expand description

A BTerm context.

Fields

width_pixels: u32height_pixels: u32original_height_pixels: u32original_width_pixels: u32fps: f32frame_time_ms: f32active_console: usizekey: Option<VirtualKeyCode>mouse_pos: (i32, i32)left_click: boolshift: boolcontrol: boolalt: boolweb_button: Option<String>quitting: boolpost_scanlines: boolpost_screenburn: boolscreen_burn_color: RGBmouse_visible: bool

Implementations

Initializes an OpenGL context and a window, stores the info in the BTerm structure.

👎Deprecated since 0.6.2: Please migrate to the BTermBuilder system instead.

Quick initialization for when you just want an 8x8 font terminal

👎Deprecated since 0.6.2: Please migrate to the BTermBuilder system instead.

Quick initialization for when you just want an 8x16 VGA font terminal

Registers a new console terminal for output, and returns its handle number.

Registers a new console terminal for output, and returns its handle number. This variant requests that the new console not render background colors, so it can be layered on top of other consoles.

Registers a new console terminal for output, and returns its handle number. This variant requests that the new console not render background colors, so it can be layered on top of other consoles.

Registers a new Sprite-based console

Sets the currently active console number.

Applies the current physical mouse position to the active console, and translates the coordinates into that console’s coordinate space.

Applies the current physical mouse position to the active console, and translates the coordinates into that console’s coordinate space.

Tells the game to quit

Render a REX Paint (https://www.gridsagegames.com/rexpaint/) file as a sprite. The sprite will be offset by offset_x and offset_y. Transparent cells will not be rendered.

Saves the entire console stack to a REX Paint XP file. If your consoles are of varying sizes, the file format supports it - but REX doesn’t. So you may want to avoid that. You can also get individual layers with to_xp_layer.

source

pub fn with_post_scanlines(&mut self, with_burn: bool)

Enable scanlines post-processing effect.

Implements console-like BTerm. Note that this isn’t a Console trait anymore, due to the need for helper generics.

Gets the active console’s size, in characters.

Request that the active console clear itself to default values.

Request that the active console clear itself to a specified background color. Has no effect on consoles that don’t have a background color.

Print a string to the active console.

Print a string to the active console, in color.

Set a single tile located at x/y to the specified foreground/background colors, and glyph.

Set a tile with “fancy” additional attributes

Sets the background color only of a specified tile.

Draws a filled box, with single line characters.

Draws a filled box, with double line characters.

Draws a single-line box, without filling in the center.

Draws a double-line box, without filling in the contents.

Draws a horizontal bar, suitable for health-bars or progress bars.

Draws a vertical bar, suitable for health-bars or progress bars.

Fills a target region with the specified color/glyph combo.

Prints centered text, centered across the whole line

Prints centered text, centered across the whole line - in color

Prints text, centered on an arbitrary point

Prints colored text, centered on an arbitrary point

Prints right-aligned text

Prints right-aligned text, in color

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.

Exports the current layer to a REX Paint file

Sets the active offset for the current layer

Sets the active scale for the current layer

Gets the active scale for the current layer

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 on a console

Change the active font for the layer. DO NOT USE WITH AMETHYST YET.

Manually override the character size for the current terminal. Use with caution!

Manually override the character size for the current terminal. Use with caution!

Take a screenshot - Native only

Register a sprite sheet (OpenGL - native or WASM - only)

Add a sprite to the current console

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.