Struct imgui::Io

source ·
#[repr(C)]
pub struct Io {
Show 60 fields pub config_flags: ConfigFlags, pub backend_flags: BackendFlags, pub display_size: [f32; 2], pub delta_time: f32, pub ini_saving_rate: f32, pub mouse_double_click_time: f32, pub mouse_double_click_max_dist: f32, pub mouse_drag_threshold: f32, pub key_repeat_delay: f32, pub key_repeat_rate: f32, pub hover_delay_normal: f32, pub hover_delay_short: f32, pub font_global_scale: f32, pub font_allow_user_scaling: bool, pub display_framebuffer_scale: [f32; 2], pub config_docking_no_split: bool, pub config_docking_with_shift: bool, pub config_docking_always_tab_bar: bool, pub config_docking_transparent_payload: bool, pub config_viewports_no_auto_merge: bool, pub config_viewports_no_task_bar_icon: bool, pub config_viewports_no_decoration: bool, pub config_viewports_no_default_parent: bool, pub mouse_draw_cursor: bool, pub config_mac_os_behaviors: bool, pub config_input_trickle_event_queue: bool, pub config_input_text_cursor_blink: bool, pub config_input_text_enter_keep_active: bool, pub config_drag_click_to_input_text: bool, pub config_windows_resize_from_edges: bool, pub config_windows_move_from_title_bar_only: bool, pub config_memory_compact_timer: f32, pub set_platform_ime_data_fn: Option<unsafe extern "C" fn(viewport: *mut ImGuiViewport, data: *mut ImGuiPlatformImeData)>, pub want_capture_mouse: bool, pub want_capture_keyboard: bool, pub want_text_input: bool, pub want_set_mouse_pos: bool, pub want_save_ini_settings: bool, pub nav_active: bool, pub nav_visible: bool, pub framerate: f32, pub metrics_render_vertices: i32, pub metrics_render_indices: i32, pub metrics_render_windows: i32, pub metrics_active_windows: i32, pub metrics_active_allocations: i32, pub mouse_delta: [f32; 2], pub key_map: [u32; 652], pub keys_down: [bool; 652], pub nav_inputs: [f32; 16], pub mouse_pos: [f32; 2], pub mouse_down: [bool; 5], pub mouse_wheel: f32, pub mouse_wheel_h: f32, pub key_ctrl: bool, pub key_shift: bool, pub key_alt: bool, pub key_super: bool, pub want_capture_mouse_unless_popup_close: bool, pub app_focus_lost: bool, /* private fields */
}
Expand description

Settings and inputs/outputs for imgui-rs

Fields§

§config_flags: ConfigFlags

Flags set by user/application

§backend_flags: BackendFlags

Flags set by backend

§display_size: [f32; 2]

Main display size in pixels

§delta_time: f32

Time elapsed since last frame, in seconds

§ini_saving_rate: f32

Minimum time between saving positions/sizes to .ini file, in seconds

§mouse_double_click_time: f32

Time for a double-click, in seconds

§mouse_double_click_max_dist: f32

Distance threshold to stay in to validate a double-click, in pixels

§mouse_drag_threshold: f32

Distance threshold before considering we are dragging

§key_repeat_delay: f32

When holding a key/button, time before it starts repeating, in seconds

§key_repeat_rate: f32

When holding a key/button, rate at which it repeats, in seconds

§hover_delay_normal: f32§hover_delay_short: f32§font_global_scale: f32

Global scale for all fonts

§font_allow_user_scaling: bool

Allow user to scale text of individual window with CTRL+wheel

§display_framebuffer_scale: [f32; 2]

For retina display or other situations where window coordinates are different from framebuffer coordinates

§config_docking_no_split: bool§config_docking_with_shift: bool§config_docking_always_tab_bar: bool§config_docking_transparent_payload: bool§config_viewports_no_auto_merge: bool§config_viewports_no_task_bar_icon: bool§config_viewports_no_decoration: bool§config_viewports_no_default_parent: bool§mouse_draw_cursor: bool

Request imgui-rs to draw a mouse cursor for you

§config_mac_os_behaviors: bool

macOS-style input behavior.

Defaults to true on Apple platforms. Changes in behavior:

  • Text editing cursor movement using Alt instead of Ctrl
  • Shortcuts using Cmd/Super instead of Ctrl
  • Line/text start and end using Cmd+Arrows instead of Home/End
  • Double-click selects by word instead of selecting the whole text
  • Multi-selection in lists uses Cmd/Super instead of Ctrl
§config_input_trickle_event_queue: bool

Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.

§config_input_text_cursor_blink: bool

Set to false to disable blinking cursor

§config_input_text_enter_keep_active: bool

Pressing Enter will keep item active and select contents (single-line only).

§config_drag_click_to_input_text: bool

Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.

§config_windows_resize_from_edges: bool

Enable resizing of windows from their edges and from the lower-left corner.

Requires HasMouserCursors in backend_flags, because it needs mouse cursor feedback.

§config_windows_move_from_title_bar_only: bool

Set to true to only allow moving windows when clicked+dragged from the title bar.

Windows without a title bar are not affected.

§config_memory_compact_timer: f32

Compact memory usage when unused.

Set to -1.0 to disable.

§set_platform_ime_data_fn: Option<unsafe extern "C" fn(viewport: *mut ImGuiViewport, data: *mut ImGuiPlatformImeData)>§want_capture_mouse: bool

When true, imgui-rs will use the mouse inputs, so do not dispatch them to your main game/application

§want_capture_keyboard: bool

When true, imgui-rs will use the keyboard inputs, so do not dispatch them to your main game/application

§want_text_input: bool

Mobile/console: when true, you may display an on-screen keyboard.

This is set by imgui-rs when it wants textual keyboard input to happen.

§want_set_mouse_pos: bool

Mouse position has been altered, so the backend should reposition the mouse on the next frame.

Set only when ConfigFlags::NavEnableSetMousePos is enabled.

§want_save_ini_settings: bool

When manual .ini load/save is active (ini_filename is None), this will be set to notify your application that you can call save_ini_settings and save the settings yourself.

Important: You need to clear this flag yourself

§nav_active: bool

Keyboard/Gamepad navigation is currently allowed

§nav_visible: bool

Keyboard/Gamepad navigation is visible and allowed

§framerate: f32

Application framerate estimation, in frames per second.

Rolling average estimation based on io.delta_time over 120 frames.

§metrics_render_vertices: i32

Vertices output during last rendering

§metrics_render_indices: i32

Indices output during last rendering (= number of triangles * 3)

§metrics_render_windows: i32

Number of visible windows

§metrics_active_windows: i32

Number of active windows

§metrics_active_allocations: i32

Number of active internal imgui-rs allocations

§mouse_delta: [f32; 2]

Mouse delta.

Note that this is zero if either current or previous position is invalid ([f32::MAX, f32::MAX]), so a disappearing/reappearing mouse won’t have a huge delta.

§key_map: [u32; 652]

Map of indices into the keys_down entries array, which represent your “native” keyboard state

§keys_down: [bool; 652]

Keyboard keys that are pressed (indexing defined by the user/application)

§nav_inputs: [f32; 16]

Gamepad inputs.

Cleared back to zero after each frame. Keyboard keys will be auto-mapped and written here by frame().

§mouse_pos: [f32; 2]

Mouse position, in pixels.

Set to [f32::MAX, f32::MAX] if mouse is unavailable (on another screen, etc.).

§mouse_down: [bool; 5]

Mouse buttons: 0=left, 1=right, 2=middle + extras

§mouse_wheel: f32

Mouse wheel (vertical).

1 unit scrolls about 5 lines of text.

§mouse_wheel_h: f32

Mouse wheel (horizontal).

Most users don’t have a mouse with a horizontal wheel, and may not be filled by all backends.

§key_ctrl: bool

Keyboard modifier pressed: Control

§key_shift: bool

Keyboard modifier pressed: Shift

§key_alt: bool

Keyboard modifier pressed: Alt

§key_super: bool

Keyboard modifier pressed: Cmd/Super/Windows

§want_capture_mouse_unless_popup_close: bool§app_focus_lost: bool

Clear buttons state when focus is lost (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn’t trigger the Alt menu toggle)

Implementations§

source§

impl Io

source

pub fn add_input_character(&mut self, character: char)

Queue new character input

source

pub fn clear_input_characters(&mut self)

Clear character input buffer

source

pub fn peek_input_characters(&self) -> String

Peek character input buffer, return a copy of entire buffer

source

pub fn input_queue_characters( &self ) -> impl DoubleEndedIterator<Item = char> + ExactSizeIterator + Clone + '_

Returns a view of the data in the input queue (without copying it).

The returned iterator is a simple mapping over a slice more or less what you need for random access to the data (Rust has no RandomAccessIterator, or we’d use that).

source

pub fn update_delta_time(&mut self, delta: Duration)

source

pub fn add_mouse_pos_event(&mut self, pos: [f32; 2])

source

pub fn add_mouse_button_event(&mut self, button: MouseButton, down: bool)

source

pub fn add_mouse_wheel_event(&mut self, wheel: [f32; 2])

source

pub fn add_key_event(&mut self, key: Key, down: bool)

source

pub fn add_key_analog_event(&mut self, key: Key, down: bool, value: f32)

Trait Implementations§

source§

impl Index<Key> for Io

§

type Output = u32

The returned type after indexing.
source§

fn index(&self, index: Key) -> &u32

Performs the indexing (container[index]) operation. Read more
source§

impl Index<MouseButton> for Io

§

type Output = bool

The returned type after indexing.
source§

fn index(&self, index: MouseButton) -> &bool

Performs the indexing (container[index]) operation. Read more
source§

impl Index<NavInput> for Io

§

type Output = f32

The returned type after indexing.
source§

fn index(&self, index: NavInput) -> &f32

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<Key> for Io

source§

fn index_mut(&mut self, index: Key) -> &mut u32

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<MouseButton> for Io

source§

fn index_mut(&mut self, index: MouseButton) -> &mut bool

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IndexMut<NavInput> for Io

source§

fn index_mut(&mut self, index: NavInput) -> &mut f32

Performs the mutable indexing (container[index]) operation. Read more
source§

impl RawCast<ImGuiIO> for Io

source§

unsafe fn from_raw(raw: &T) -> &Self

Casts an immutable reference from the raw type Read more
source§

unsafe fn from_raw_mut(raw: &mut T) -> &mut Self

Casts a mutable reference from the raw type Read more
source§

unsafe fn raw(&self) -> &T

Casts an immutable reference to the raw type Read more
source§

unsafe fn raw_mut(&mut self) -> &mut T

Casts a mutable reference to the raw type Read more

Auto Trait Implementations§

§

impl Freeze for Io

§

impl RefUnwindSafe for Io

§

impl !Send for Io

§

impl !Sync for Io

§

impl Unpin for Io

§

impl UnwindSafe for Io

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.