[−][src]Crate egui
Egui core library
To quickly get started with Egui, you can take a look at egui_template
which uses eframe
.
To create a GUI using Egui you first need a CtxRef
(by convention referred to by ctx
).
Use one of SidePanel
, TopPanel
, CentralPanel
, Window
or Area
to
get access to an Ui
where you can put widgets. For example:
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::CtxRef::default(); // 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 = egui_ctx.tessellate(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::Color32; |
pub use paint::FontDefinitions; |
pub use paint::FontFamily; |
pub use paint::PaintCmd; |
pub use paint::PaintJobs; |
pub use paint::Rgba; |
pub use paint::Stroke; |
pub use paint::TextStyle; |
pub use paint::TextureId; |
pub use style::Style; |
pub use util::mutex; |
pub use widgets::*; |
Modules
align | One- and two-dimensional alignment ( |
containers | Containers are pieces of the UI which wraps other pieces of UI. Examples: |
math | Vectors, positions, rectangles etc. |
menu | Menu bar functionality (very basic so far). |
paint | 2D graphics/rendering. Fonts, textures, color, geometry, tessellation etc. |
style | |
util | Miscellaneous tools used by the rest of Egui. |
widgets | Widgets are pieces of GUI such as |
Macros
github_link_file | Create a |
github_link_file_line | Create a |
Structs
Context | This is the first thing you need when working with Egui. Create using |
CtxRef | A wrapper around |
Id | Egui tracks widgets frame-to-frame using |
InputState | Input state that Egui updates each frame. |
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. |
Modifiers | State of the modifier keys. These must be fed to Egui. |
MouseInput | Mouse (or touch) state. |
Output | What Egui emits each frame. The backend should use this. |
PaintCmdIdx | |
PaintList | A list of |
Painter | Helper to paint shapes and text to a specific region on a specific layer. |
RawInput | What the integrations provides to Egui at the start of each frame. |
Region | This describes the bounds and existing contents of an |
Response | The result of adding a widget to a |
Sense | What sort of interaction is a widget sensitive to? |
Texture | An 8-bit texture containing font data. |
Ui | This is what you use to place widgets. |
Enums
CursorIcon | A mouse cursor icon. |
Direction | Layout direction, one of |
Event | An input event generated by the integration. |
Key | Keyboard keys. |
Order | Different layer categories |
Functions
warn_if_debug_build | Helper function that adds a label when compiling with debug assertions enabled. |