[−][src]Crate egui
Egui core library
To get started with Egui, you can use one of the available integrations
such as egui_web
or egui_glium
.
Whatever you use, you need an egui::Context
(by convention referred to by ctx
).
With it you can then get access to an Ui
where you can put widgets.
Use one of SidePanel
, TopPanel
, CentralPanel
, Window
or Area
. For instace:
egui::CentralPanel::default().show(&ctx, |ui| { ui.label("Hello"); });
To write your own integration for Egui you need to do this:
let mut egui_ctx = egui::Context::new(); // Game loop: loop { let raw_input: egui::RawInput = my_integration.gather_input(); egui_ctx.begin_frame(raw_input); my_app.ui(&egui_ctx); // add panels, windows and widgets to `egui_ctx` here let (output, paint_commands) = egui_ctx.end_frame(); let paint_jobs = self.ctx.tesselate(paint_commands); // create triangles to paint my_integration.paint(paint_jobs); my_integration.set_cursor_icon(output.cursor_icon); // Also see `egui::Output` for more }
Re-exports
pub use align::Align; |
pub use containers::*; |
pub use math::*; |
pub use paint::color; |
pub use paint::FontDefinitions; |
pub use paint::FontFamily; |
pub use paint::PaintCmd; |
pub use paint::PaintJobs; |
pub use paint::Rgba; |
pub use paint::Srgba; |
pub use paint::Stroke; |
pub use paint::TextStyle; |
pub use paint::TextureId; |
pub use widgets::*; |
Modules
align | |
app | Traits and helper for writing Egui apps. |
containers | Containers are pieces of the UI which wraps other pieces of UI. Examples: |
demos | Demo-code for showing how Egui is used. |
math | Vectors, positions, rectangles etc. |
menu | Menu bar functionality (very basic so far). |
mutex | Helper module for a Mutex that detects double-locking on the same thread in debug mode. |
paint | Graphics module. |
widgets | Widgets are pieces of GUI such as labels, buttons, sliders etc. |
Macros
github_link_file | Create a |
github_link_file_line | Create a |
label | Shortcut for creating a |
Structs
Context | Thi is the first thing you need when working with Egui. |
DemoApp | Demonstrates how to make an app using Egui. |
GraphicLayers | |
History | This struct tracks recent values of some time series. |
Id | Egui tracks widgets frame-to-frame using |
InputState | What egui maintains |
LayerId | An identifier for a paint layer.
Also acts as an identifier for |
Layout | The layout of a |
Memory | The data that Egui persists between frames. |
MouseInput | What egui maintains |
Output | What Egui emits each frame. The backend should use this. |
PaintCmdIdx | A unique identifier of a specific |
PaintList | Each |
Painter | Helper to paint shapes and text to a specific region on a specific layer. |
RawInput | What the backend provides to Egui at the start of each frame. |
Response | The result of adding a widget to an |
Sense | What sort of interaction is a widget sensitive to? |
Style | Specifies the look and feel of a |
Texture | An 8-bit texture containing font data. |
Ui | Represents a region of the screen with a type of layout (horizontal or vertical). |
Enums
CursorIcon | |
Direction |
|
Event | An input event. Only covers events used by Egui. |
Key | Keyboard key name. Only covers keys used by Egui. |
Order | Different layer categories |