Struct EguiArk

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

Bindings to the egui library.

Instantiate one EguiArk in your module.

let mut egui = EguiArk::default();
let ctx = egui.begin_frame(&applet());
ui(ctx);
let ctx = egui.end_frame(&render(), &applet());

fn ui(ctx: &mut egui::Context) {
    egui::Window::new("My window").show(ctx, |ui| {
        ui.label("Hello world!");
    });
}

Implementations§

Source§

impl EguiArk

Source

pub fn ctx(&self) -> &Context

Access to the egui context.

Source

pub fn begin_frame(&mut self, applet: &Applet) -> Context

Call before using egui. This gathers input and prepares for a new frame.

Source

pub fn end_frame(&mut self, render: &Render, applet: &Applet)

Call after using egui. This will render the interface.

Source

pub fn wants_pointer_input(&self) -> bool

True if egui is currently interested in the pointer (mouse/touch). Could be the mouse is hovering over a egui window, or the user is dragging an egui widget. If false, the mouse is outside of any egui area and so you may be interested in what it is doing (e.g. controlling your game).

Source

pub fn wants_keyboard_input(&self) -> bool

If true, egui is currently listening on text input (e.g. typing text in a TextEdit).

Source

pub fn is_mouse_down(&self) -> bool

Source

pub fn persist(&self) -> Value

Save egui state (window positions etc)

Source

pub fn restore(&self, value: Value)

Restore egui (window positions etc)

Source

pub fn viewport(&self) -> Rectangle

Almost the same as available_rect(), however, in physical pixels, not logical (i.e. available_rect() scaled by the DPI factor).

How much space is still available after panels has been added. This is the “background” area, what egui doesn’t cover with panels (but may cover with windows). This is also the area to which windows are constrained.

Trait Implementations§

Source§

impl Default for EguiArk

Source§

fn default() -> EguiArk

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for EguiArk

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for EguiArk

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,