egui/scripts
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
..
clippy_wasm Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
build_demo_web.sh Rename `docs/` to `web_demo/` 2023-11-16 16:44:30 +01:00
cargo_deny.sh Update dependencies in Cargo.lock (#3401) 2023-09-27 12:49:24 +02:00
check.sh Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
clippy_wasm.sh Fix: `request_repaint_after` works even when called from background thread (#2939) 2023-04-20 10:56:52 +02:00
docs.sh Rename `sh/` folder to `scripts/` 2023-04-18 17:10:52 +02:00
find_bloat.sh Rename `sh/` folder to `scripts/` 2023-04-18 17:10:52 +02:00
generate_changelog.py Fix HTTP web demo (#3407) 2023-09-28 12:06:55 +02:00
generate_example_screenshots.sh Update example screenshots 2023-05-23 13:38:02 +02:00
lint.py Add `#[inline]` to all builder-pattern functions (#3557) 2023-11-16 13:50:05 +01:00
setup_web.sh Update to wasm-bindgen 0.2.87 (#3237) 2023-08-11 15:34:16 +02:00
start_server.sh Rename `docs/` to `web_demo/` 2023-11-16 16:44:30 +01:00
wasm_bindgen_check.sh Rename `sh/` folder to `scripts/` 2023-04-18 17:10:52 +02:00
wasm_size.sh Rename `docs/` to `web_demo/` 2023-11-16 16:44:30 +01:00