egui/examples
Emil Ernerfeldt 6607cd95f9
⚠️ `Frame` now includes stroke width as part of padding (#5575)
* Part of https://github.com/emilk/egui/issues/4019

`Frame` now includes the width of the stroke as part of its size. From
the new docs:

### `Frame` docs
The total (outer) size of a frame is `content_size + inner_margin +
2*stroke.width + outer_margin`.

Everything within the stroke is filled with the fill color (if any).

```text
+-----------------^-------------------------------------- -+
|                 | outer_margin                           |
|    +------------v----^------------------------------+    |
|    |                 | stroke width                 |    |
|    |    +------------v---^---------------------+    |    |
|    |    |                | inner_margin        |    |    |
|    |    |    +-----------v----------------+    |    |    |
|    |    |    |             ^              |    |    |    |
|    |    |    |             |              |    |    |    |
|    |    |    |<------ content_size ------>|    |    |    |
|    |    |    |             |              |    |    |    |
|    |    |    |             v              |    |    |    |
|    |    |    +------- content_rect -------+    |    |    |
|    |    |                                      |    |    |
|    |    +-------------fill_rect ---------------+    |    |
|    |                                                |    |
|    +----------------- widget_rect ------------------+    |
|                                                          |
+---------------------- outer_rect ------------------------+
```

The four rectangles, from inside to outside, are:
* `content_rect`: the rectangle that is made available to the inner
[`Ui`] or widget.
* `fill_rect`: the rectangle that is filled with the fill color (inside
the stroke, if any).
* `widget_rect`: is the interactive part of the widget (what sense
clicks etc).
* `outer_rect`: what is allocated in the outer [`Ui`], and is what is
returned by [`Response::rect`].

### Notes
This required rewriting a lot of the layout code for `egui::Window`,
which was a massive pain. But now the window margin and stroke width is
properly accounted for everywhere.
2025-01-04 10:29:22 +01:00
..
confirm_exit Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
custom_3d_glow Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
custom_font Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
custom_font_style Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
custom_keypad Store `Margin` using `i8` to reduce its size (#5567) 2025-01-02 16:05:52 +01:00
custom_style Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
custom_window_frame ⚠️ `Frame` now includes stroke width as part of padding (#5575) 2025-01-04 10:29:22 +01:00
file_dialog Update some crates to fix CI (#5456) 2024-12-10 17:16:38 +01:00
hello_android Make all lines and rectangles crisp (#5518) 2024-12-26 21:02:27 +01:00
hello_world Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
hello_world_par Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
hello_world_simple Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
images Animated WebP support (#5470) 2024-12-29 11:46:08 +01:00
keyboard_events Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
multiple_viewports Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
popups Add `ComboBox::close_behavior` (#5305) 2024-10-29 12:39:44 +01:00
puffin_profiler Use `profiling` crate to support more profiler backends (#5150) 2024-12-16 09:15:54 +01:00
screenshot Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
serial_windows Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
user_attention Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
README.md examples/README.md: explain that the examples are for master 2023-02-08 20:34:43 +01:00
run_all.sh Fix up some examples (#3614) 2023-11-23 12:58:44 +01:00

README.md

egui and eframe examples

All the examples in this folder uses eframe to set up a window for egui. Some examples are specific to eframe, but many are applicable to any egui integration.

There are a lot more examples at https://www.egui.rs, and it has links to the source code of each example.

Also check out the official docs at https://docs.rs/egui and https://docs.rs/eframe.

Note that all the examples on master are for the latest master version of egui.

If you want to look for examples for a specific version of egui, go to that tag, e.g. https://github.com/emilk/egui/tree/latest/examples.