Commit graph

62 commits

Author SHA1 Message Date
Emil Ernerfeldt
08cc07bb2d Release 0.15.0 - Syntax highlighting, hscroll, egui-winit and egui_glow 2021-10-24 16:15:07 +02:00
Emil Ernerfeldt
a0cd41755e Add more clippy lints 2021-10-20 16:30:39 +02:00
Emil Ernerfeldt
8178d23d19
Deduplicate code found in both egui_glium and egui_glow (#819)
* Move window building to egui-winit

* Move icon loading to egui-winit

* `use glow::HasContext;` -> `use glow::HasContext as _;`

* Move FileStorage into epi behind a feature flag

* De-duplicate screen_size_in_pixels and native_pixels_per_point

* Move creation of FileStorage to epi

* Handle epi app output (window size changes etc) in egui-winit

* Move app and memory persistence and autosave logic to egui-winit

* fix check.sh

* Make the epi backend opt-in for egui_glium and egui_glow

* Fix persistence

* Add integration name to epi::IntegrationInfo and the demo

* Clean up Cargo.toml files and fix making egui_glium optional

* fix typo

* Make egui_glium compile without the `epi` feature
2021-10-19 21:40:55 +02:00
Emil Ernerfeldt
e547b149ca Improve docs, especially of epaint, and add epaint/CHANGELOG.md 2021-10-10 15:35:13 +02:00
Stock84
cd2227814f
Implement bytemuck behind a feature (#775) 2021-10-07 22:30:15 +02:00
Emil Ernerfeldt
f59abd9684 Clean up some macro syntax 2021-10-02 21:08:00 +02:00
Emil Ernerfeldt
e7cfda4941
Shape refactor (#705)
* More introspection stats about vertices/indices etc

* more serde derive

* #[inline] to Shape constructors

* Introduce RectShape

* Introduce CircleShape

* Introduce PathShape

* More serde derive

* impl Copy for RectShape and CircleShape

* Simplify some code

* More serde derive

* Add helpers for appending more input or output

* Serde derives for RawInput

* Rename Fonts::from_definitions to Fonts::new

* Add Output::take

* refactor EguiGlium slightly

* Derive PartialEq for RawInput

* Improve egui::util::History interface

* tweaks

* Improve History filter: add minimum length

* Calculate galley bounding rect

* tessellator: cull line segments and paths

* tessellator: cull meshes

* Fix bug in History bandwidth estimator
2021-09-20 21:36:56 +02:00
Emil Ernerfeldt
f37180f7dc
Bump MSRV (Minimum Supported Rust Version) to 1.54.0 (#703)
1.51.0 clippy has been giving me trouble (not reporting all problems),
and so I take the easy way out and just bump MSRV.

We will upgrade to 1.56.0 once it comes around anyway
to get access to that sweet disjoint capture in closures
(https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html)
2021-09-09 00:16:06 +02:00
Emil Ernerfeldt
14c989fdfa Implement rotating text
Closes https://github.com/emilk/egui/issues/428
2021-09-05 09:06:53 +02:00
Emil Ernerfeldt
3b75a84d3b Point crate repository & homepage urls to their subfolders 2021-09-03 21:12:44 +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
105b999cb6
Horizontal scrolling (#663)
* First pass (missing rendering the bar)

* Render horizontal bars, and change Window scroll API

* emath: add impl Index + IndexMut for Align2

* Scrolling: fix subtle sizing bugs

* Add horizontal scrolling to color test

* try to wrap content before showing scrollbars, + add auto-shrink option

* Add hscroll to the misc demo window

* Fix for putting wrapping labels in an infinitely wide layout

* Add a egui_asserts to protect against nans in the layout engine

* Add line about horizontal scrolling to changelog

* Add example to docs of ScrollArea

* code cleanup
2021-08-28 13:18:21 +02:00
Emil Ernerfeldt
1fbce6b2c3 Remove everything marked deprecated 2021-08-28 11:46:30 +02:00
Emil Ernerfeldt
cb566fc295 Release 0.14.0 - Ui panels and bug fixes 2021-08-24 16:47:10 +02:00
Emil Ernerfeldt
f940ae9edf Fix alignment corner case (infinite size in infinite range) 2021-08-24 15:58:57 +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
Emil Ernerfeldt
3e2746a288
Make it easy to panels inside of Ui:s (#629)
* Allow using the layout cursor to restrict available area

* Avoid id clashes when putting panels inside a Ui

* Panels: Propagate height/width range to inner Ui

* Allow easy placement of panels inside of Ui:s

* demo: simplify Windows with Panels demo
2021-08-20 00:10:06 +02:00
Emil Ernerfeldt
12334addda Add Vec2::to_pos2 2021-07-20 14:32:12 +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
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
Emil Ernerfeldt
269a4538d9 clippy fixes for rust 1.53 2021-06-22 23:38:34 +02:00
Emil Ernerfeldt
c9766f8a7b
Resizable panels + right and bottom panels (#438)
* Side panel resizing and add right panels

* Add resizable top/bottom panels

* Deprecate TopPanel

* Final tweaks and update CHANGELOG.md
2021-05-26 22:06:10 +02:00
Emil Ernerfeldt
6e5b52e3bc Add features extra_asserts and extra_debug_asserts for more asserts
This replaces all debug_asserts with these opt-in asserts

Related: https://github.com/emilk/egui/issues/395
2021-05-17 22:38:39 +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
b1559963bf Enable a bunch more clippy lints 2021-05-09 14:13:09 +02:00
Emil Ernerfeldt
4022b84ae7 group rustdoc lints under rustdoc:: prefix 2021-05-09 14:01:57 +02:00
Emil Ernerfeldt
fb5176c133 #![allow(clippy::float_cmp)] everywhere
it has always been an annoyance, never a help
2021-05-09 14:00:53 +02:00
Emil Ernerfeldt
4bb79a7047 Move normalize_angle to emath 2021-05-08 23:42:17 +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
Emil Ernerfeldt
0f112db550 Reduce binary size with more inlining and less monomorphization
5%=150kB savings on egui_demo_app wasm
2021-04-24 09:54:11 +02:00
Emil Ernerfeldt
cb14e8571f Add Vec2::LEFT,RIGHT,UP,DOWN and Vec2::angle 2021-04-20 23:04:04 +02:00
Emil Ernerfeldt
58ebb217dc Tesselator: ignore zero-sized clip rects
Improves https://github.com/emilk/egui/issues/328
2021-04-20 10:05:47 +02:00
Emil Ernerfeldt
0f1df90d90 Tesselator: ignore non-positive clip rectangles
Closes https://github.com/emilk/egui/issues/328
2021-04-19 23:00:30 +02:00
Emil Ernerfeldt
580d27e0d3
Add anchors to windows and areas (#310)
This is so that you can put a window in e.g. the top right corner
or the center of the screen.
2021-04-18 10:01:41 +02:00
Emil Ernerfeldt
76d5229821
CI: run cargo doc (#309)
* Deny doc errors

* Add intentional bad intradoc link to test CI

* Add cargo doc to CI

* Fix carg doc web (add wasm32 target)

* Fix intentionally broken doc-link
2021-04-15 10:35:15 +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
d7f9e2246c Add a bunch on inline annotations 2021-04-01 23:07:15 +02:00
Emil Ernerfeldt
0a21b01c31 Fix nightly build: remove deprecated missing_crate_level_docs lint
Closes https://github.com/emilk/egui/issues/250 and
https://github.com/emilk/egui/pull/251
2021-03-31 20:00:22 +02:00
Emil Ernerfeldt
46425f1e38 Optimize: add #[inline(always)] to various low-level things
saves up to 20% (text tesselation), and at least 5% overall
2021-03-28 23:16:19 +02:00
Emil Ernerfeldt
5481aa8d98 Add DragValue::new and Slider::new 2021-03-27 16:03:11 +01:00
Emil Ernerfeldt
fd3444473f Add some clippy lints 2021-03-23 19:53:31 +01:00
Emil Ernerfeldt
f5c372910c Replace emath::clamp with f32::clamp (new in rustc 1.50) 2021-03-21 17:47:03 +01:00
Emil Ernerfeldt
ec9f374d8c Fix: centered horizontal layouts should never overflow upwards 2021-03-21 10:31:18 +01:00
Emil Ernerfeldt
5621a46b4b emath: add any_nan to Vec2, Pos2 and Rect 2021-03-20 16:18:04 +01:00
Emil Ernerfeldt
4e852727c0 Add helper functions to Rect 2021-03-20 16:17:58 +01:00
Emil Ernerfeldt
4c45ca113e Make sure to include license files in the next release 2021-03-09 18:35:13 +01:00
Emil Ernerfeldt
fb2db4940e Release 0.10.0 - Plot and polish 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
82350a2f1e Improve documentation 2021-02-21 10:12:08 +01:00
Emil Ernerfeldt
a19140ec67 A simple 2D plot library 2021-02-17 22:54:10 +01:00