Struct Renderer

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

The main Renderer type.

Implementations§

Source§

impl Renderer

Source

pub fn new(gl: GlContext) -> Result<Renderer>

Creates a new renderer object.

You need to provide the OpenGL context yourself.

Source

pub fn gl_context(&self) -> &GlContext

Gets a reference to the OpenGL context.

Source

pub fn set_background_color(&mut self, color: Option<Color>)

Sets the default background color.

The set color will be used for glClear(GL_COLOR_BUFFER_BIT). Set to None to avoid this, and use easy_imgui::UiBuilder::pre_render to do whatever clearing you need, if anything.

Source

pub fn set_matrix(&mut self, matrix: Option<Matrix3<f32>>)

Sets the 2D (3x3) matrix transformation for the UI display.

If you set this matrix to Some then it is your responsibility to also call the appropriate gl.viewport().

Source

pub fn background_color(&self) -> Option<Color>

Gets the background color.

Source

pub fn imgui(&mut self) -> &mut Context

Gets the stored Dear ImGui context.

Source

pub fn set_size(&mut self, size: Vector2, scale: f32)

Sets the UI size, in logical units, and the scale factor.

Source

pub fn size(&mut self) -> Vector2

Gets the UI size, in logical units.

Source

pub fn do_frame<A: UiBuilder>(&mut self, app: &mut A)

Builds and renders a UI frame, using the app easy_imgui::UiBuilder.

Source

pub fn map_tex(ntex: Texture) -> TextureId

Maps an OpenGL texture to an ImGui texture.

Source

pub fn unmap_tex(tex: TextureId) -> Option<Texture>

Gets an OpenGL texture from an ImGui texture.

Trait Implementations§

Source§

impl Drop for Renderer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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
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.