[][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::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 = 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 util::mutex;
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: Window, ScrollArea, Resize, etc.

demos

Demo-code for showing how Egui is used.

math

Vectors, positions, rectangles etc.

menu

Menu bar functionality (very basic so far).

paint

Graphics module.

util

Tools used by Egui, but that doesn't depend on anything in Egui.

widgets

Widgets are pieces of GUI such as labels, buttons, sliders etc.

Macros

github_link_file

Create a Hyperlink to this file on github. Example: ui.add(github_link_file!("https://github.com/YOUR/PROJECT/blob/master/", "(source code)"));

github_link_file_line

Create a Hyperlink to this file (and line) on Github Example: ui.add(github_link_file_line!("https://github.com/YOUR/PROJECT/blob/master/", "(source code)"));

Structs

Context

Thi is the first thing you need when working with Egui.

CtxRef

A wrapper around CtxRef. This is how you will normally access a Context.

DemoApp

Demonstrates how to make an app using Egui.

GraphicLayers
Id

Egui tracks widgets frame-to-frame using Ids.

InputState

What egui maintains

LayerId

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

Layout

The layout of a Ui, e.g. horizontal left-aligned.

Memory

The data that Egui persists between frames.

Modifiers

State of the modifier keys. These must be fed to Egui.

MouseInput

What egui maintains

Output

What Egui emits each frame. The backend should use this.

PaintCmdIdx

A unique identifier of a specific PaintCmd in a PaintList.

PaintList

Each PaintCmd is paired with a clip rectangle.

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.

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 an Ui.

Sense

What sort of interaction is a widget sensitive to?

Style

Specifies the look and feel of a Ui.

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

Main layout direction

Event

An input event. Only covers events used by Egui.

Key

Keyboard key name. Only covers keys used by Egui (mostly for text editing).

Order

Different layer categories