pub struct Renderer { /* private fields */ }Expand description
Draws glyph buffers with a font atlas texture.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn new(
atlas: FontAtlasDef,
png: &[u8],
clear: Rgb,
images: &ImageTable,
bytes: fn(&str) -> Option<&'static [u8]>,
) -> Result<Self, String>
pub fn new( atlas: FontAtlasDef, png: &[u8], clear: Rgb, images: &ImageTable, bytes: fn(&str) -> Option<&'static [u8]>, ) -> Result<Self, String>
Uploads the atlas image (png) and every image in images (read
with bytes, the game’s embedded files by path). clear is the
console background (the palette’s black). An image that can’t be
decoded is logged and left without a texture.
Sourcepub fn set_clear(&mut self, clear: Rgb)
pub fn set_clear(&mut self, clear: Rgb)
Sets the console background (the palette’s black), which a
colour theme changes.
Sourcepub fn draw(&mut self, buf: &GlyphBuffer)
pub fn draw(&mut self, buf: &GlyphBuffer)
Draws buf scaled to the current window size.
The layout is computed in physical framebuffer pixels (the window is
high_dpi), so the integer scale holds on scaled Windows displays;
coordinates are divided by the DPI factor only because macroquad’s
default camera works in logical units.
With a backdrop (game ADR-0048) the order is: the clear colour, the scene inside its window, then the console over it, whose see-through cells have no background.