Commit graph

261 commits

Author SHA1 Message Date
Emil Ernerfeldt
08b208586a egui-winit: if clipboard fails to start, fall back to local clipboard 2022-04-12 11:39:35 +02:00
Emil Ernerfeldt
de038b9546 Update tts to 0.21.1 2022-04-11 16:36:25 +02:00
Emil Ernerfeldt
cf0338d48f
Rust 1.60.0 + refactor cargo features (#1467)
* Update to rust 1.60.0
* Rename the feature `convert_bytemuck` to `bytemuck`
* Rename the feature `serialize` to `serde`.
* Make use of the "weak dependency" cargo feature
* Set rust-version = "1.60" for all crates
* egui_glow: clipboard, links, persistence & winit are now opt-in features
2022-04-09 13:54:47 +02:00
Emil Ernerfeldt
7cd285ecbc misc clippy fixes from 1.60.0 2022-04-07 17:03:19 +02:00
4JX
6091370962
Add more doc-links in docstrings (#1419) 2022-04-03 18:18:35 +02:00
follower
95ff7ec000
Typo fixes in egui_web README (#1433) 2022-03-30 10:19:42 +02:00
Emil Ernerfeldt
8f178fa4e0
Add glow::Context to epi::Frame (#1425)
This can be used, for instance, to:

* Render things to offscreen buffers.
* Read the pixel buffer from the previous frame (glow::Context::read_pixels).
* Render things behind the egui windows.
2022-03-27 15:20:45 +02:00
Emil Ernerfeldt
b7ebe16cfb
Storage and frame refactor (#1418)
The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since https://github.com/emilk/egui/pull/1366)
2022-03-25 21:19:31 +01:00
Emil Ernerfeldt
15254f8235
Remove the single_threaded/multi_threaded feature flags (#1390)
Always use parking_lot for mutexes, i.e. always be multi-threaded.

Closes #1379
2022-03-21 22:20:37 +01:00
Emil Ernerfeldt
fda8189cba
Move lints list to .carg/config.toml (#1394)
That way they apply to all crates equally.

See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why.
2022-03-21 16:54:29 +01:00
Emil Ernerfeldt
465c96122c
egui_web: by default, use full web browser size (#1378)
* egui_web: by default, use full web browser size

Closes https://github.com/emilk/egui/issues/1377

* Remove max_size_points from demo app
2022-03-19 13:47:30 +01:00
Emil Ernerfeldt
c8f6cae362
eframe app creation refactor (#1363)
* Change how eframe apps are created
* eframe: re-export epi::* so users don't need to care about what epi is
2022-03-16 15:39:48 +01:00
Emil Ernerfeldt
c768d1d48e
Context::request_repaint will wake up the UI thread (#1366)
This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.

Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.

This is the first callback added to the egui API, which otherwise is
completely driven by data.

The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
2022-03-15 17:21:52 +01:00
Emil Ernerfeldt
6aee4997d4
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
2022-03-14 13:25:11 +01:00
Emil Ernerfeldt
50539bd31a
egui_web: always use the glow painter, and remove the old WebGL code. (#1356)
* egui_web: always use the glow painter, and remove the old WebGL code.
* Clean up the WebPainter trait
* Clarify WebGL1 warning text in color test

The glow painter became standard in egui 0.17, and I've heard no complaints! So let's simplify and go all in on glow.

Part of https://github.com/emilk/egui/issues/1198
2022-03-11 19:15:06 +01:00
Emil Ernerfeldt
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
Zachary Kohnen
5d950e1c15
[egui_web] Prevent event handlers from running if code has panicked (#1306)
Closes: #1290

Fix panic reported by @Titaniumtown
See https://github.com/emilk/egui/pull/1306#issuecomment-1060775376
2022-03-10 08:13:32 +01:00
Emil Ernerfeldt
a05520b9d3 Release 0.17.0 - Improved font selection and image handling 2022-02-22 19:32:30 +01:00
Emil Ernerfeldt
31d324932c
Introduce egui::FullOutput, returned from Context::run (#1292)
* Introduce `egui::FullOutput`, returned from `Context::run`
* Rename `Output` to `PlatformOutput`
2022-02-22 17:13:53 +01:00
Emil Ernerfeldt
745f209c61 Make RawInput.max_texture_side an Option 2022-02-22 13:21:28 +01:00
Emil Ernerfeldt
0a46634c13 Simplify backends by adding fn paint_and_update_textures helper 2022-02-21 21:49:52 +01:00
Emil Ernerfeldt
6d68838821 Clean up changelogs 2022-02-21 16:10:05 +01:00
Emil Ernerfeldt
713917e481 refactor egui_web (break up lib.rs) 2022-02-21 09:28:12 +01:00
Emil Ernerfeldt
89d19860b8 Misc code cleanup, docs fixes, etc 2022-02-19 20:58:28 +01:00
Emil Ernerfeldt
b5c8f034e7
Add web location info to egui_web/epi (#1258)
This adds all parts of the web "location" (URL) to frame.info().web_info, included a HashMap of the query parameters, percent-decoded and ready to go.

This lets you easily pass key-value pairs to your eframe web app.
2022-02-17 16:46:43 +01:00
Yusuf Bera Ertan
1ebb5ccabf
Don't install console panic hook and tracing wasm subscriber in egui_web (#1230)
Do so in egui_demo_app instead
2022-02-10 15:44:41 +01:00
Emil Ernerfeldt
0fa4bb9c64 Clean up all Cargo.toml: put features higher, and document them better 2022-02-05 11:11:15 +01:00
Juan Campa
ea28485bdd
Remove prevent_default for mousedown events (#1209)
This fixes the issue of tabs not focusing when egui is used inside vscode
2022-02-05 08:56:53 +01:00
Emil Ernerfeldt
8dfa6ce2f0 Update tts 0.19 -> 0.20 2022-02-04 13:18:03 +01:00
Emil Ernerfeldt
c6ac1827f6
Use tracing crate for logging (#1192)
* egui_web: use tracing crate
* egui_glow: use tracing crate
* Log at the debug level
* egui_demo_app: enable tracing to log to stdout
* Use tracing in egui-winit
* Add opt-in tracing support to egui
2022-02-01 12:27:39 +01:00
Emil Ernerfeldt
871a200ecf egui_web glow painter: return errors instead of panic 2022-01-31 19:15:48 +01:00
Emil Ernerfeldt
ef81a52951 egui_web: log panics using console.error 2022-01-31 19:14:50 +01:00
Emil Ernerfeldt
532990d3dd emilk.github.io -> www.egui.rs 2022-01-30 22:01:33 +01:00
Emil Ernerfeldt
b618636425
Add ui.data(), ctx.data(), ctx.options() and ctx.tessellation_options() (#1175)
Helpful access deeper into Memory
2022-01-29 17:53:41 +01:00
Emil Ernerfeldt
fa43d16c41
Choose your own font and size (#1154)
* Refactor text layout: don't need &Fonts in all functions
* Replace indexing in Fonts with member function
* Wrap Fonts in a Mutex
* Remove mutex for Font::glyph_info_cache
* Remove RwLock around Font::characters
* Put FontsImpl and GalleyCache behind the same Mutex
* Round font sizes to whole pixels before deduplicating them
* Make TextStyle !Copy
* Implement user-named TextStyle:s
* round font size earlier
* Cache fonts based on family and size
* Move TextStyle into egui and Style
* Remove body_text_style
* Query graphics about max texture size and use that as font atlas size
* Recreate texture atlas when it is getting full
2022-01-24 14:32:36 +01:00
Emil Ernerfeldt
462f181db3
Partial font texture update (#1149) 2022-01-22 11:23:12 +01:00
Emil Ernerfeldt
e957674467 glow on web: simplify the webgl2 vs webgl1 selection 2022-01-22 09:07:41 +01:00
awaken1ng
30f9700f6c
egui-web: Update web_location_hash when hash in URL changes (#1140) 2022-01-21 19:41:18 +01:00
Emil Ernerfeldt
a689b623a6
Make shift-scroll do horizontal scrolling on all platforms (#1136)
Closes https://github.com/emilk/egui/issues/1135
2022-01-21 10:48:44 +01:00
Emil Ernerfeldt
66d80e2519
Texture loading in egui (#1110)
* Move texture allocation into epaint/egui proper
* Add TextureHandle
* egui_glow: cast using bytemuck instead of unsafe code
* Optimize glium painter
* Optimize WebGL
* Add example of loading an image from file
2022-01-15 13:59:52 +01:00
Emil Ernerfeldt
205e04aa18
Fix bugs in glow on web (#1092)
* Re-add check of WEBGL_debug_renderer_info to avoid OpenGL error

I removed this check in https://github.com/emilk/egui/pull/1020
because it produced a warning on Firefox. Better a warning
than an OpenGL error though.

* Bug fix: don't ask for webgl context and then later for webgl2 context

The browser will only allow the first thing we check, so this will
prevent webgl2 from working.
2022-01-10 23:19:30 +01:00
Emil Ernerfeldt
d5673412dd
Put everything in Context behind the same Mutex (#1050)
* Move all interior mutability from Context to CtxRef and make it a handle
* Rename `CtxRef` to `Context`
* The old `Context` is now `ContextImpl` and is non-pub
* Add benchmark Painter::rect

Co-authored-by: Daniel Keller <dklr433@gmail.com>
2022-01-10 23:13:10 +01:00
Simon Werner
225d2b506d
Split Event::Text into Text and Paste (#1058)
* Split `Event::Text` into `Text` and `Paste`

* Added explicit Event::Paste change

See #1043

* Link to PR in changelog (not the issue)

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-01-10 23:12:30 +01:00
Emil Ernerfeldt
650057dd4a Improve OpenGL error detection and reporting in egui_glow
May help to diagnose https://github.com/emilk/egui/issues/1087
2022-01-09 23:04:00 +01:00
Emil Ernerfeldt
b1fd6a44e8
Switch to using glow as the default renderer both on native and the web (#1020)
* Switch to using glow as the default renderer both on native and the web
* Simplify code to find WebGL context for glow
* egui_web: make webgl an opt-in feature
* Stop using deprecated WEBGL_debug_renderer_info
2021-12-31 15:17:55 +01:00
Emil Ernerfeldt
0146c7e7fc Release 0.16.0 - Context menus and rich text 2021-12-29 12:07:05 +01:00
Emil Ernerfeldt
037ca5f9cd update tts 0.17 -> 0.19 2021-12-29 10:56:16 +01:00
Emil Ernerfeldt
190c85a40f Rename Texture to FontImage 2021-12-28 21:19:24 +01:00
Emil Ernerfeldt
cda4c8ba13 Minor cleanup following https://github.com/emilk/egui/pull/999 2021-12-28 13:22:01 +01:00
Emil Ernerfeldt
b7441eeee7
Make epi::Frame cloneable so you can allocate textures in other threads (#999)
Closes https://github.com/emilk/egui/issues/673

Also adds `epi::Image`
2021-12-26 21:21:28 +01:00