2022-10-10 15:42:50 +08:00
# Architecture
2021-02-21 17:12:08 +08:00
This document describes how the crates that make up egui are all connected.
2023-05-23 01:20:58 +08:00
Also see [`CONTRIBUTING.md` ](CONTRIBUTING.md ) for what to do before opening a PR.
2021-02-21 17:12:08 +08:00
## Crate overview
2023-11-12 01:35:57 +08:00
The crates in this repository are: `egui, emath, epaint, egui_extras, egui_plot, egui-winit, egui_glow, egui_demo_lib, egui_demo_app` .
2021-02-21 17:12:08 +08:00
### `egui`: The main GUI library.
Example code: `if ui.button("Click me").clicked() { … }`
This is the crate where the bulk of the code is at. `egui` depends only on `emath` and `epaint` .
### `emath`: minimal 2D math library
Examples: `Vec2, Pos2, Rect, lerp, remap`
### `epaint`
2d shapes and text that can be turned into textured triangles.
Example: `Shape::Circle { center, radius, fill, stroke }`
2022-03-22 05:20:37 +08:00
Depends on `emath` .
2021-02-21 17:12:08 +08:00
2022-02-21 22:26:26 +08:00
### `egui_extras`
This adds additional features on top of `egui` .
2023-08-27 23:22:49 +08:00
### `egui_plot`
Plotting for `egui` .
2021-09-28 23:33:28 +08:00
### `egui-winit`
This crates provides bindings between [`egui` ](https://github.com/emilk/egui ) and [winit ](https://crates.io/crates/winit ).
The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc.
2021-10-19 05:13:32 +08:00
### `egui_glow`
Puts an egui app inside a native window on your laptop. Paints the triangles that egui outputs using [glow ](https://github.com/grovesNL/glow ).
2021-02-21 17:12:08 +08:00
### `eframe`
2022-04-30 16:44:35 +08:00
`eframe` is the official `egui` framework, built so you can compile the same app for either web or native.
2021-02-21 17:12:08 +08:00
2022-01-31 05:01:33 +08:00
The demo that you can see at < https: // www . egui . rs > is using `eframe` to host the `egui` . The demo code is found in:
2021-02-21 17:12:08 +08:00
### `egui_demo_lib`
2022-04-30 16:44:35 +08:00
Depends on `egui` .
2021-02-21 17:12:08 +08:00
This contains a bunch of uses of `egui` and looks like the ui code you would write for an `egui` app.
### `egui_demo_app`
Thin wrapper around `egui_demo_lib` so we can compile it to a web site or a native app executable.
Depends on `egui_demo_lib` + `eframe` .
### Other integrations
There are also many great integrations for game engines such as `bevy` and `miniquad` which you can find at < https: // github . com / emilk / egui # integrations > .