Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer { /* private fields */ }
Expand description

Draws glyph buffers with a font atlas texture.

Implementations§

Source§

impl Renderer

Source

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.

Source

pub fn set_clear(&mut self, clear: Rgb)

Sets the console background (the palette’s black), which a colour theme changes.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.