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
impl EguiArk
Sourcepub fn begin_frame(&mut self, applet: &Applet) -> Context
pub fn begin_frame(&mut self, applet: &Applet) -> Context
Call before using egui. This gathers input and prepares for a new frame.
Sourcepub fn end_frame(&mut self, render: &Render, applet: &Applet)
pub fn end_frame(&mut self, render: &Render, applet: &Applet)
Call after using egui. This will render the interface.
Sourcepub fn wants_pointer_input(&self) -> bool
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).
Sourcepub fn wants_keyboard_input(&self) -> bool
pub fn wants_keyboard_input(&self) -> bool
If true, egui is currently listening on text input (e.g. typing text in a TextEdit
).
pub fn is_mouse_down(&self) -> bool
Sourcepub fn viewport(&self) -> Rectangle
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.