egui/examples
Emil Ernerfeldt 1571027556
Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564)
* Part of https://github.com/emilk/egui/issues/3556

## In short
You now almost never need to use `eframe::Frame` - instead use
`ui.input(|i| i.viewport())` for information about the current viewport
(native window), and use `ctx.send_viewport_cmd` to modify it.

## In detail

This PR removes most commands from `eframe::Frame`, and replaces them
with `ViewportCommand`.
So `frame.close()` becomes
`ctx.send_viewport_cmd(ViewportCommand::Close)`, etc.

`frame.info().window_info` is now also gone, replaced with `ui.input(|i|
i.viewport())`.

`frame.info().native_pixels_per_point` is replaced with `ui.input(|i|
i.raw.native_pixels_per_point)`.

`RawInput` now contains one `ViewportInfo` for each viewport.

Screenshots are taken with
`ctx.send_viewport_cmd(ViewportCommand::Screenshots)` and are returned
in `egui::Event` which you can check with:

``` ust
ui.input(|i| {
    for event in &i.raw.events {
        if let egui::Event::Screenshot { viewport_id, image } = event {
            // handle it here
        }
    }
});
```

### Motivation
You no longer need to pass around the `&eframe::Frame` everywhere.
This also opens the door for other integrations to use the same API of
`ViewportCommand`s.
2023-11-18 19:27:53 +01:00
..
confirm_exit Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
custom_3d_glow Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
custom_font Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
custom_font_style Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
custom_window_frame Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
file_dialog Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
hello_world Update example screenshots 2023-09-27 15:34:39 +02:00
hello_world_par Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
hello_world_simple Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
images Add `emath::Vec2b`, replacing `egui_plot::AxisBools` (#3543) 2023-11-11 21:31:36 +01:00
keyboard_events Add `emath::Vec2b`, replacing `egui_plot::AxisBools` (#3543) 2023-11-11 21:31:36 +01:00
multiple_viewports Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
puffin_profiler Add `Context::open_url` and `Context::copy_text` (#3380) 2023-09-24 09:31:21 +02:00
save_plot Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
screenshot Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
serial_windows Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
test_viewports Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
user_attention Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
README.md examples/README.md: explain that the examples are for master 2023-02-08 20:34:43 +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.