Struct StatsRenderer

Source
pub struct StatsRenderer<F: Factory<Resources> + Clone> { /* private fields */ }

Implementations§

Source§

impl<F: Factory<Resources> + Clone> StatsRenderer<F>

Source

pub fn new(corner: Corner) -> Self

Construct a new stats renderer.

Source

pub fn init( &mut self, factory: F, window_dimensions: (f32, f32), main_color: RenderTargetView<Resources, Rgba8>, main_depth: DepthStencilView<Resources, DepthStencil>, font_size: u8, offset: (u32, u32), padding: i32, col_spacing: i32, ) -> Result<(), GfxTextError>

Initialize the renderer.

Source

pub fn text(&self) -> Arc<Mutex<String>>

Get a reference to the text that is rendered.

Source

pub fn has_text(&self) -> bool

Check whether any text is set to render.

Source

pub fn set_text(&self, text: String)

Set the text that is rendered.

Source

pub fn draw<C: CommandBuffer<Resources>, T: RenderFormat>( &mut self, encoder: &mut Encoder<Resources, C>, target: &RenderTargetView<Resources, T>, ) -> Result<(), GfxTextError>

Draw the renderer to the given context.

This method should be called once each render loop iteration, to properly draw the stats.

Source

pub fn update_views( &mut self, window: &WindowedContext<PossiblyCurrent>, dimensions: (f32, f32), )

Update the stats rendering view, and the window dimensions. This should be called when the GL rendering window is resized.

Auto Trait Implementations§

§

impl<F> Freeze for StatsRenderer<F>
where F: Freeze,

§

impl<F> !RefUnwindSafe for StatsRenderer<F>

§

impl<F> Send for StatsRenderer<F>
where F: Send,

§

impl<F> Sync for StatsRenderer<F>
where F: Sync,

§

impl<F> Unpin for StatsRenderer<F>
where F: Unpin,

§

impl<F> !UnwindSafe for StatsRenderer<F>

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.