Struct imgui_winit_support::WinitPlatform[][src]

pub struct WinitPlatform { /* fields omitted */ }
Expand description

winit backend platform state

Implementations

impl WinitPlatform[src]

pub fn init(imgui: &mut Context) -> WinitPlatform[src]

Initializes a winit platform instance and configures imgui.

This function configures imgui-rs in the following ways:

  • backend flags are updated
  • keys are configured
  • platform name is set

pub fn attach_window(
    &mut self,
    io: &mut Io,
    window: &Window,
    hidpi_mode: HiDpiMode
)
[src]

Attaches the platform instance to a winit window.

This function configures imgui-rs in the following ways:

  • framebuffer scale (= DPI factor) is set
  • display size is set

pub fn hidpi_factor(&self) -> f64[src]

Returns the current DPI factor.

The value might not be the same as the winit DPI factor (depends on the used DPI mode)

pub fn scale_size_from_winit(
    &self,
    window: &Window,
    logical_size: LogicalSize<f64>
) -> LogicalSize<f64>
[src]

Scales a logical size coming from winit using the current DPI mode.

This utility function is useful if you are using a DPI mode other than default, and want your application to use the same logical coordinates as imgui-rs.

pub fn scale_pos_from_winit(
    &self,
    window: &Window,
    logical_pos: LogicalPosition<f64>
) -> LogicalPosition<f64>
[src]

Scales a logical position coming from winit using the current DPI mode.

This utility function is useful if you are using a DPI mode other than default, and want your application to use the same logical coordinates as imgui-rs.

pub fn scale_pos_for_winit(
    &self,
    window: &Window,
    logical_pos: LogicalPosition<f64>
) -> LogicalPosition<f64>
[src]

Scales a logical position for winit using the current DPI mode.

This utility function is useful if you are using a DPI mode other than default, and want your application to use the same logical coordinates as imgui-rs.

pub fn handle_event<T>(
    &mut self,
    io: &mut Io,
    window: &Window,
    event: &Event<'_, T>
)
[src]

Handles a winit event.

This function performs the following actions (depends on the event):

  • window size / dpi factor changes are applied
  • keyboard state is updated
  • mouse state is updated

pub fn prepare_frame(
    &self,
    io: &mut Io,
    window: &Window
) -> Result<(), ExternalError>
[src]

Frame preparation callback.

Call this before calling the imgui-rs context frame function. This function performs the following actions:

  • mouse cursor is repositioned (if requested by imgui-rs)

pub fn prepare_render(&mut self, ui: &Ui<'_>, window: &Window)[src]

Render preparation callback.

Call this before calling the imgui-rs UI render_with/render function. This function performs the following actions:

  • mouse cursor is changed and/or hidden (if requested by imgui-rs)

Trait Implementations

impl Debug for WinitPlatform[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.