Struct easy_imgui_renderer::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 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>,

§

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

§

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.