egui/examples
Jan Procházka ec671e754f
Managed texture loading (#3297)
* add types from proposal

* add load methods on `egui::Context`

* implement loaders from proposal in `egui_extras`

* impl `From<Vec2>` for `SizeHint`

* re-export `SizeHint` from `egui` root

* rework `svg` example to use new managed `Image`

* split loaders into separate files + add logging

* add `log_trace`

* clean up `RetainedImage` from `svg` example

* refactor ehttp loader response to bytes mapping

* remove spammy trace

* load images even without extension

* fix lints

* remove unused imports

* use `Image2` in `download_image`

* use `visuals.error_fg_color` in `Image2` error state

* update lockfile

* use `Arc<ColorImage>` in `ImageData` + add `forget` API

* add `ui.image2`

* add byte size query api

* use iterators to sum loader byte sizes

* add static image loading

* use static image in `svg` example

* small refactor of `Image2::ui` texture loading code

* add `ImageFit` to size images properly

* remove println calls

* add bad image load to `download_image` example

* add loader file extension support tests

* fix lint errors in `loaders`

* remove unused `poll-promise` dependency

* add some docs to `Image2`

* add some docs to `egui_extras::loaders::install`

* explain `loaders::install` in examples

* fix lint

* upgrade `ehttp` to `0.3` for some crates

* Remove some unused dependencies

* Remove unnecessary context clone

* Turn on the `log` create feature of egui_extras in all examples

* rename `forget` and document it

* derive `Debug` on `SizeHint`

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* round when converting SizeHint from vec2

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* add `load` module docs

* docstring `add_loader` methods

* expose + document `load_include_bytes`

* cache texture handles in `DefaultTextureLoader`

* add `image2` doctest + further document `Image2`

* use `Default` for default `Image2` options

* update `image2` doc comment

* mention immediate-mode safety

* more fit calculation into inherent impl

* add hover text on spinner

* add `all-loaders` feature

* clarify `egui_extras::loaders::install` behavior

* explain how to enable image formats

* properly format `uri`

* use `thread::Builder` instead of `spawn`

* use eq op instead of `matches`

* inline `From<Arc<ColorImage>>` for `ImageData`

* allow non-`'static` bytes + `forget` in `DefaultTextureLoader`

* sort features

* change `ehttp` feature to `http`

* update `Image2` docs

* refactor loader cache type

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-09-06 10:51:51 +02:00
..
confirm_exit Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02: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 Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
download_image Managed texture loading (#3297) 2023-09-06 10:51:51 +02:00
file_dialog Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
hello_world Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +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
keyboard_events Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
puffin_profiler Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
retained_image Managed texture loading (#3297) 2023-09-06 10:51:51 +02:00
save_plot Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
screenshot Managed texture loading (#3297) 2023-09-06 10:51:51 +02:00
serial_windows Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02:00
svg Managed texture loading (#3297) 2023-09-06 10:51:51 +02:00
user_attention Update MSRV to Rust 1.70.0 (#3310) 2023-09-06 07:59:24 +02: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.