pub struct SpriteConsole {
pub width: u32,
pub height: u32,
pub sprite_sheet: usize,
pub sprites: Vec<RenderSprite>,
pub is_dirty: bool,
/* private fields */
}
Expand description
A sparse console. Rather than storing every cell on the screen, it stores just cells that have data.
Fields§
§width: u32
§height: u32
§sprite_sheet: usize
§sprites: Vec<RenderSprite>
§is_dirty: bool
Implementations§
Source§impl SpriteConsole
impl SpriteConsole
Sourcepub fn init(width: u32, height: u32, sprite_sheet: usize) -> Box<SpriteConsole>
pub fn init(width: u32, height: u32, sprite_sheet: usize) -> Box<SpriteConsole>
Initializes the console.
pub fn render_sprite(&mut self, sprite: RenderSprite)
Trait Implementations§
Source§impl Console for SpriteConsole
impl Console for SpriteConsole
Source§fn cls_bg(&mut self, _background: RGBA)
fn cls_bg(&mut self, _background: RGBA)
Clear the screen. Since we don’t HAVE a background, it doesn’t use it.
Source§fn print_color(&mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _output: &str)
fn print_color(&mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _output: &str)
Prints a string to an x/y position, with foreground and background colors.
Source§fn set(&mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _glyph: u16)
fn set(&mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _glyph: u16)
Sets a single cell in the console
Source§fn set_bg(&mut self, _x: i32, _y: i32, _bg: RGBA)
fn set_bg(&mut self, _x: i32, _y: i32, _bg: RGBA)
Sets a single cell in the console’s background
Source§fn draw_box(
&mut self,
_sx: i32,
_sy: i32,
_width: i32,
_height: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_box( &mut self, _sx: i32, _sy: i32, _width: i32, _height: i32, _fg: RGBA, _bg: RGBA, )
Draws a box, starting at x/y with the extents width/height using CP437 line characters
Source§fn draw_box_double(
&mut self,
_sx: i32,
_sy: i32,
_width: i32,
_height: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_box_double( &mut self, _sx: i32, _sy: i32, _width: i32, _height: i32, _fg: RGBA, _bg: RGBA, )
Draws a box, starting at x/y with the extents width/height using CP437 double line characters
Source§fn draw_hollow_box(
&mut self,
_sx: i32,
_sy: i32,
_width: i32,
_height: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_hollow_box( &mut self, _sx: i32, _sy: i32, _width: i32, _height: i32, _fg: RGBA, _bg: RGBA, )
Draws a box, starting at x/y with the extents width/height using CP437 line characters
Source§fn draw_hollow_box_double(
&mut self,
_sx: i32,
_sy: i32,
_width: i32,
_height: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_hollow_box_double( &mut self, _sx: i32, _sy: i32, _width: i32, _height: i32, _fg: RGBA, _bg: RGBA, )
Draws a box, starting at x/y with the extents width/height using CP437 double line characters
Source§fn fill_region(&mut self, _target: Rect, _glyph: u16, _fg: RGBA, _bg: RGBA)
fn fill_region(&mut self, _target: Rect, _glyph: u16, _fg: RGBA, _bg: RGBA)
Fills a rectangle with the specified rendering information
Source§fn draw_bar_horizontal(
&mut self,
_sx: i32,
_sy: i32,
_width: i32,
_n: i32,
_max: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_bar_horizontal( &mut self, _sx: i32, _sy: i32, _width: i32, _n: i32, _max: i32, _fg: RGBA, _bg: RGBA, )
Draws a horizontal progress bar
Source§fn draw_bar_vertical(
&mut self,
_sx: i32,
_sy: i32,
_height: i32,
_n: i32,
_max: i32,
_fg: RGBA,
_bg: RGBA,
)
fn draw_bar_vertical( &mut self, _sx: i32, _sy: i32, _height: i32, _n: i32, _max: i32, _fg: RGBA, _bg: RGBA, )
Draws a vertical progress bar
Source§fn print_centered(&mut self, _y: i32, _text: &str)
fn print_centered(&mut self, _y: i32, _text: &str)
Prints text, centered to the whole console width, at vertical location y.
Source§fn print_color_centered(&mut self, _y: i32, _fg: RGBA, _bg: RGBA, _text: &str)
fn print_color_centered(&mut self, _y: i32, _fg: RGBA, _bg: RGBA, _text: &str)
Prints text in color, centered to the whole console width, at vertical location y.
Source§fn print_centered_at(&mut self, _x: i32, _y: i32, _text: &str)
fn print_centered_at(&mut self, _x: i32, _y: i32, _text: &str)
Prints text, centered to the whole console width, at vertical location y.
Source§fn print_color_centered_at(
&mut self,
_x: i32,
_y: i32,
_fg: RGBA,
_bg: RGBA,
_text: &str,
)
fn print_color_centered_at( &mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _text: &str, )
Prints text in color, centered to the whole console width, at vertical location y.
Source§fn print_color_right(
&mut self,
_x: i32,
_y: i32,
_fg: RGBA,
_bg: RGBA,
_text: &str,
)
fn print_color_right( &mut self, _x: i32, _y: i32, _fg: RGBA, _bg: RGBA, _text: &str, )
Prints colored text right-aligned
Source§fn printer(
&mut self,
_x: i32,
_y: i32,
_output: &str,
_align: TextAlign,
_background: Option<RGBA>,
)
fn printer( &mut self, _x: i32, _y: i32, _output: &str, _align: TextAlign, _background: Option<RGBA>, )
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.
Source§fn to_xp_layer(&self) -> XpLayer
fn to_xp_layer(&self) -> XpLayer
Saves the layer to an XpFile structure
Source§fn set_offset(&mut self, _x: f32, _y: f32)
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.
Source§fn set_clipping(&mut self, _clipping: Option<Rect>)
fn set_clipping(&mut self, _clipping: Option<Rect>)
Permits the creation of an arbitrary clipping rectangle. It’s a really good idea to make sure that this rectangle is entirely valid.
Source§fn get_clipping(&self) -> Option<Rect>
fn get_clipping(&self) -> Option<Rect>
Returns the current arbitrary clipping rectangle, None if there isn’t one.
Source§fn set_all_fg_alpha(&mut self, alpha: f32)
fn set_all_fg_alpha(&mut self, alpha: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
Source§fn set_all_bg_alpha(&mut self, _alpha: f32)
fn set_all_bg_alpha(&mut self, _alpha: f32)
Sets ALL tiles background alpha (only tiles that exist, in sparse consoles).
Source§fn set_all_alpha(&mut self, fg: f32, _bg: f32)
fn set_all_alpha(&mut self, fg: f32, _bg: f32)
Sets ALL tiles foreground alpha (only tiles that exist, in sparse consoles).
Source§fn set_translation_mode(&mut self, _mode: CharacterTranslationMode)
fn set_translation_mode(&mut self, _mode: CharacterTranslationMode)
Sets the character translation mode
Source§fn set_char_size(&mut self, width: u32, height: u32)
fn set_char_size(&mut self, width: u32, height: u32)
Sets the character size of the terminal