[][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 (Align::Center, LEFT_TOP etc).

containers

Containers are pieces of the UI which wraps other pieces of UI. Examples: Window, ScrollArea, Resize, etc.

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 Label, Button, Slider etc.

Macros

github_link_file

Create a Hyperlink to this file on github.

github_link_file_line

Create a Hyperlink to this file (and line) on Github

Structs

Context

This is the first thing you need when working with Egui. Create using CtxRef.

CtxRef

A wrapper around Arc<Context>. This is how you will normally create and access a Context.

Id

Egui tracks widgets frame-to-frame using Ids.

InputState

Input state that Egui updates each frame.

LayerId

An identifier for a paint layer. Also acts as an identifier for Area:s.

Layout

The layout of a Ui, e.g. "vertical & centered".

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

A unique identifier of a specific PaintCmd in a PaintList.

PaintList

A list of PaintCmds paired with a clip rectangle.

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 Ui. It is what is used and updated by Layout when adding new widgets.

Response

The result of adding a widget to a Ui.

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 LeftToRight, RightToLeft, TopDown, BottomUp.

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.