Commit Graph

136 Commits

Author SHA1 Message Date
Emil Ernerfeldt 22a3a75eb5 Optimization: replace HashSet uses with AHashSet 2021-10-09 14:15:45 +02:00
Stock84 cd2227814f
Implement `bytemuck` behind a feature (#775) 2021-10-07 22:30:15 +02:00
Emil Ernerfeldt a1bf5aff47 Add Memory::caches for caching things from one frame to the next 2021-10-06 17:54:45 +02:00
Emil Ernerfeldt f0868c2f07 Code editor demo: nice syntax highlighting with customizable theme 2021-10-01 21:29:33 +02:00
Emil Ernerfeldt e2bdd40985 Move WindowSettings from egui_glium to egui-winit 2021-09-30 19:18:51 +02:00
Emil Ernerfeldt 3e1db880dc
Revert change to winit event loop in egui_glium (#756)
* Revert change to winit event loop in egui_glium

This reverts https://github.com/emilk/egui/pull/631

Fixes https://github.com/emilk/egui/issues/755

* Add example of file dialogs and file drag-and-drop

* fix ci
2021-09-30 18:53:41 +02:00
Emil Ernerfeldt e2fa13ed2a cargo update 2021-09-28 20:46:28 +02:00
Emil Ernerfeldt 1b36863248
Split out new crate egui-winit from egui_glium (#735) 2021-09-28 17:33:28 +02:00
triangle drawer 203d571c8b
Add api for accessing backend texture via epi (#695)
* Define NativeTexture trait for offscreen rendering
add demo for NativeTexture trait

* write changelog

* add comment for native texture example

* formatting

* add license of Rust logo

* NativeTexture trait method rename
remove duplicate function with native texture
remove rust logo

* deprecated notice for register_glium_texture,register_webgl_texture

* collect deprecated notice
2021-09-05 11:00:45 +02:00
Emil Ernerfeldt 6902151a96 Add example of loading and showing an image with eframe/egui
Closes https://github.com/emilk/egui/pull/700
2021-09-04 17:44:01 +02:00
Emil Ernerfeldt 5f88d89f74
Faster galley cache (#699)
* Speed up galley cache by only using the hash as key

This hashes the job but doesn't compare them with Eq,
which speeds up demo_with_tessellate__realistic by 5-6%,
winning back all the performance lost in
https://github.com/emilk/egui/pull/682

* Remove custom Eq/PartialEq code for LayoutJob and friends

* Silence clippy

* Unrelated clippy fixes
2021-09-04 10:19:58 +02:00
Emil Ernerfeldt 9598596bdc
Replace all http code in epi/eframe/egui_glium/egui_web with ehttp (#697)
I've extracted all the http request code and turned it
into its own crate at <https://github.com/emilk/ehttp>.

There was never a reason for the HTTP request library to be part of
`eframe`. Much better to have it as its own crate!
2021-09-03 21:04:43 +02:00
Emil Ernerfeldt de1a1ba9b2
New text layout (#682)
This PR introduces a completely rewritten text layout engine which is simpler and more powerful. It allows mixing different text styles (heading, body, etc) and formats (color, underlining, strikethrough, …) in the same layout pass, and baked into the same `Galley`.

This opens up the door to having a syntax-highlighed code editor, or a WYSIWYG markdown editor.

One major change is the color is now baked in at layout time. However, many widgets changes text color on hovered. But we need to do the text layout before we know if it is hovered. Therefor the painter has an option to override the text color of a galley.


## Performance
Text layout alone is about 20% slower, but a lot of that is because more tessellation is done upfront. Text tessellation is now a lot faster, but text layout + tessellation still lands at a net loss of 5-10% in performance. There are however a few tricks to speed it up (like using `smallvec`) which I am saving for later. Text layout is also cached, meaning that in most cases (when all text isn't changing each frame) text tessellation is actually more important (and that's more than 2x faster!).

Sadly, the actual text cache lookup is significantly slower (300ns -> 600ns). That's because the `TextLayoutJob` is a lot bigger (it has more options, like underlining, fonts etc), so it is slower to hash and compare. I have an idea how to speed this up, but I need to do some other work before I can implement that.

All in all, the performance impact on `demo_with_tesselate__realistic` is about 5-6% in the red. Not great; not terrible. The benefits are worth it, but I also think with some work I can get that down significantly, hopefully down to the old levels.
2021-09-03 18:18:00 +02:00
Emil Ernerfeldt 776770cdcd
Publish 0.14.2 (#670)
* Fix window resize bug introduced in `0.14.1`.

* tweak plot demo layout to allow more narrow window

* Release 0.14.2 - Window resize fix
2021-08-28 12:19:35 +02:00
Emil Ernerfeldt 2ce99f3a12 Release 0.14.1 - Bug fixes and better web blending 2021-08-28 11:04:39 +02:00
Emil Ernerfeldt cb566fc295 Release 0.14.0 - Ui panels and bug fixes 2021-08-24 16:47:10 +02:00
sigaloid 12fd4906de
Update dependencies and pass all clippy's (#636)
* Cargo update

https://pastebin.com/raw/KWNuJD9u

* Cargo clippy +nightly

* Remove deprecated clippy

* Fix unbalanced backtick (now passes cargo {+nightly,} clippy)
2021-08-20 22:31:20 +02:00
mental eefc56c213
fix and pin web-sys breakage in `Navigator::clipboard` (#608) 2021-08-15 16:55:33 +02:00
Emil Ernerfeldt 52e3663958 Release egui 0.13.1: Plot fixes 2021-06-28 11:05:27 +02:00
Emil Ernerfeldt ccecad88b1 egui_glium and eframe 0.13.1: fix http feature and docs 2021-06-24 20:36:36 +02:00
Emil Ernerfeldt d807451348 Release 0.13.0 - Better panels, plots and new visual style 2021-06-24 20:00:06 +02:00
Emil Ernerfeldt eb6c293774 Update crates glium, tts, and run cargo update 2021-06-24 17:51:39 +02:00
Emil Ernerfeldt 1363ac4a24 demo: in font book, ask font what characters are supported
This replaces manual lists with a call to ab_glypgh::Font::codepoint_ids
plus names from the unicode_names2 crate.
2021-06-24 17:35:56 +02:00
Benjamin Bouvier e22c242d17
Use ab_glyph instead of rusttype for font rendering (#490)
* Use ab_glyph instead of rusttype for font rendering

* address review feedback
2021-06-24 12:13:57 +02:00
Emil Ernerfeldt 6e7e88ba80
Use old 1.51 toolchain instead of bleeding edge (#505)
* Use old 1.51 toolchain instead of bleeding edge

1.52 and 1.53 has problems with incremental compilation,
so some people chose to stay on 1.51 for now.

So let's make sure egui supports 1.51 for a while!

* Update to cint 0.2.2 to get rust 1.51.0 compatability
2021-06-23 09:16:39 +02:00
Violeta Hernández 66095b69a7
Disable default features of `ord-float` (#440)
* Might fix #439

* `cargo update`

If the page builds, then this did fix it.
2021-05-27 20:25:30 +02:00
Gray Olson c0929014bf
Add support for `cint` (conversions to and from color types) (#393)
* implement cint for color types under feature flag

* upgrade to cint 0.2, remove from default features

* upgrade to cint 0.2.1, add a couple more from/into implementations

* changelog entry

* fix typo in changelog

* sort dependency

* fmt
2021-05-20 20:09:52 +02:00
Emil Ernerfeldt 50a2ed0a14 Update wasm-bindgen to 0.2.74 2021-05-12 19:40:15 +02:00
Emil Ernerfeldt 8f8ba16696 Release 0.12.0 - Multitouch, user memory, window pivots, and improved plots 2021-05-10 18:27:39 +02:00
Emil Ernerfeldt 7747a1f171 Update tts 0.15 -> 0.16 2021-05-09 14:42:14 +02:00
Emil Ernerfeldt c476ddb57c cargo update 2021-05-09 14:37:56 +02:00
Luis Wirth 87bc26fb5a
implement mint conversions (#352)
* Implement mint conversions

Implement conversions for [mint](https://docs.rs/mint) (math interoperability standard types).

- `impl {From, Into}<mint::Point2> for Pos2`
- `impl {From, Into}<mint::Vector2> for Vec2`

* Forward `mint` feature: egui -> epaint -> emath
2021-05-08 08:17:01 +02:00
ilya sheprut 186362a4b8
Arbitrary data in `Memory` using `Any`, fix #255 (#257)
* init work

* implement deferred deserialization

* many improvements
* rename `DataElement` -> `AnyMapElement`
* make `data` in `Memory` as public field of type with public interface
* make interface more rich
* transform most unwraps to proper error handling
* make `AnyMap` store by `TypeId`, so now individual type can be counted and reset

* improve storing TypeId between different rust versions

* rewrite system widgets to use AnyMap

* refactor everything
* replace `serde_json` -> `ron`
* move `any_map` to module
* separate `AnyMap` into `AnyMapId` and `serializable::AnyMapId` in order to not require `serde` traits in methods
* add `AnyMap` and `serializable::AnyMap` that stores elements just by type, without `Id`
* write documentation
* change tooltips and color picker to use `Memory::data_temp`

* fix bugs and docs

* Apply suggestions from code review

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

* rename `AnyMap` → `TypeMap`

* rename `AnyMapId` → `AnyMap`, add generic <Key> to it

* rename files `id_map` → `any_map`

* move out usages from `serializable` mod

* rename `ToDeserialize` → `Serialized`

* fix bug with counting

* add tests, and...
* rename `reset` → `remove`
* add function `remove_by_type`
* format code

* improve code
* make identical interface for serialized and simple maps
* make serialized maps serialized fully, without features by moving this into `Memory` struct with `#[cfg(feature = "persistence")]` under fields
* move `serialized::TypeId` into `AnyMapElement` struct

* fix pipeline and add one more test

* update docs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-12 21:53:32 +02:00
Emil Ernerfeldt d544c3dd8b Release 0.11.0 - Optimization, screen reader & new layout logic 2021-04-05 14:49:06 +02:00
Emil Ernerfeldt 77014c7c75 cargo update 2021-04-05 14:23:42 +02:00
Emil Ernerfeldt 7792ee0422 Update tts from 0.14 -> 0.15 (screen reader feature) 2021-04-05 14:23:42 +02:00
Emil Ernerfeldt aba2108159 Replace JSON with RON for persistence (epi/eframe/glium/web) 2021-04-05 14:23:42 +02:00
Emil Ernerfeldt 94baf98eab Add a galley cache to Fonts to avoid doing the same layout each frame 2021-03-29 22:49:48 +02:00
Emil Ernerfeldt 8e7d4ff4fd Upgrade wasm-bindgen 0.2.71 -> 0.2.72 2021-03-25 16:30:09 +01:00
Jay Oster 269bcdfce3
Replace clipboard with copypasta (#221)
- Fixes #146
2021-03-10 11:16:45 +01:00
Emil Ernerfeldt 44cd304cdf Add experimental screen_reader feature
Part of https://github.com/emilk/egui/issues/167
2021-03-08 20:58:01 +01:00
Emil Ernerfeldt fb2db4940e Release 0.10.0 - Plot and polish 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt a9a49f19ca cargo update 2021-02-28 19:13:05 +01:00
Emil Ernerfeldt b61db038f2 Release 0.9.0 - light mode, right clicks and more 2021-02-07 17:06:51 +01:00
Emil Ernerfeldt d9472035d7 Update ahash 0.6.3 -> 0.7.0 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt 7641807665 cargo update 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt 29bb7c9f9d egui_demo_lib 0.8.1: export ColorTest 2021-01-19 17:13:29 +01:00
Emil Ernerfeldt 37a3fe7f76 Release 0.8.0 - Grid layout & new visual style 2021-01-17 15:28:52 +01:00
Emil Ernerfeldt a229f581b9 cargo update 2021-01-17 15:01:25 +01:00
Emil Ernerfeldt 26d576f510 Break out mod paint into new crate epaint 2021-01-10 15:42:46 +01:00