Commit Graph

1905 Commits

Author SHA1 Message Date
Emil Ernerfeldt a9fd03709e Add new NativeOptions: vsync multisampling depth_buffer stencil_buffer
These are useful when embedding 3D into eframe.
2022-03-23 11:13:57 +01:00
Emil Ernerfeldt c63bdeab67
Add an example of showing 3D using three-d (#1407) 2022-03-23 11:06:33 +01:00
Emil Ernerfeldt 85e3ec5027 Log supported OpenGL extensions if VAO is in doubt. 2022-03-23 10:10:12 +01:00
Emil Ernerfeldt ea9393aa9b
glow painter improvements (#1406)
* Add viewport info to PaintCallback
* glow: be more explicit with more state
* glow: Refactor VAO
2022-03-22 23:11:27 +01:00
Emil Ernerfeldt 6f10e2e725
Improve glow error reporting (#1403)
* Improve glow error reporting
* Add more check_for_gl_error calls
* Remove clippy lint list from egui_glow lib.rs
  - Forgotten in https://github.com/emilk/egui/pull/1394
* egui_glow: move vao code to own file
* Cleanup: `use glow::HasContext as _;`

Co-authored-by: Zachary Kohnen <me@dusterthefirst.com>
2022-03-22 16:04:06 +01:00
Emil Ernerfeldt 41b178b6ec
Use atomic_refcell instead of parking_lot for wasm32 targets (#1404)
Closes https://github.com/emilk/egui/issues/1401
2022-03-22 15:34:21 +01:00
Edgeworth e5aeb1618f
Export the PlotBounds type. (#1392) 2022-03-22 08:59:13 +01:00
Hunter522 0a400a5bcc
Add Image::rotate and Mesh::rotate (#1371)
Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
2022-03-22 08:44:23 +01:00
Emil Ernerfeldt 805539b50d
Add example of custom window frame for native window using eframe (#1396) 2022-03-21 22:20:58 +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 5c68edbb15 Clippy fixes 2022-03-21 22:14:25 +01:00
Emil Ernerfeldt 339b28b470 Add Frame::outer_margin, and rename Frame::margin to Frame::inner_margin 2022-03-21 21:44:52 +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 ccbddcfe95 Add example of how to move text cursor in a TextEdit 2022-03-20 23:08:19 +01:00
Emil Ernerfeldt fde9c232b3 Improve the introspection paint stats 2022-03-20 23:05:16 +01:00
Emil Ernerfeldt e369626d3d glow: move where FRAMEBUFFER_SRGB is enabled 2022-03-20 23:04:44 +01:00
Emil Ernerfeldt d20be45c4c Add egui_assert to ensure texture size is <= max_texture_side 2022-03-20 22:49:44 +01:00
Emil Ernerfeldt 861e129ace Add Shape::image convenience method 2022-03-20 20:39:48 +01:00
jean-airoldie 734d4c57ad
Expose more epaint tessellator methods (#1384)
* Expose more tessellator method

* Make public the Tessellator methods to tessellate a circle, a
    mesh, a rectangle, a line, a path, a quadratic and cubic
    bezier curve.
* Add doc to tessellate_text.
* Add Mesh::append_ref method.

* Make tessellate_text take a reference

* Fix breaking change in benchmark
2022-03-20 20:38:48 +01:00
Zachary Kohnen 8bb381d50b
Fix code that could lead to a possible deadlock. (#1380)
* Fix code that could lead to a possible deadlock.

Drop implementations are not called until the end of a statement. The statement changed in this commit therefore took 4 read locks on a RwLock which can lead to problems if a write lock is requested between any of these read locks. The code looks like it would only hold one lock at a time but it does not drop any of the locks until after the arithmatic operations complete, which leads to this situation. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=996079046184329f3a9df1cd19c87da8 to see this in action. The fix is to just take one lock and share it between the three calls to num_presses, letting it drop at the end of the scope.

* Fix code that may cause a deadlock in `MenuRoot::stationary_interaction`

The issue here is related to that in 9673b8f2a08302c10ffcfd063f2dbdec4301d3e2 in that the lock is not dropped when it is expected.  Since the `RwLockReadGuard` produced by `ctx.input()` has a reference taken from it (one into `pointer`), the lock cannot be dropped until that reference is no longre valid, which is the end of the scope (in this case this function).  The following `ctx.input()` then attempts to aquire a second lock on the `RwLock`, creating the same situation that was found in the referenced commit.

This has been resolved by holding one lock on the input for the whole function.

* Reference this PR from comments in the code for future maintainers

* Add the change to the changelog

* Use full link to PR

* Use full link to PR

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-03-20 20:30:38 +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 6ce8594351 README.md: add links to license files
Closes https://github.com/emilk/egui/issues/1367
2022-03-19 13:34:08 +01:00
Emil Ernerfeldt 12c31e980b
Add Ui::push_id (#1374) 2022-03-19 13:30:43 +01:00
Emil Ernerfeldt f6af7bda27 Better error message when trying to upload too large texture
Closes https://github.com/emilk/egui/issues/1370
2022-03-19 13:30:29 +01:00
jean-airoldie 0d47e57775
Add Tessellator::set_clip_rect (#1369)
This allows the user to set the outer rectangle used for culling,
which is required to be able to implement its own tessellate_shapes.
2022-03-19 13:01:33 +01:00
zam-5 cecb48af03
Added plot_ui::plot_clicked() (#1372) 2022-03-19 13:00:18 +01:00
Emil Ernerfeldt c69f39e869
Box the app creator (#1373) 2022-03-18 14:23:07 +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 002158050b
Add Frame::canvas - bright in bright mode, dark in dark mode (#1362)
and use it in the demo app
2022-03-14 12:33:17 +01:00
Emil Ernerfeldt 29c52e8eb6
Remove epi backend from egui_glow (#1361) 2022-03-13 22:49:24 +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 52b4ab4e18
Remove egui_glium as a backend for eframe (#1357)
eframe will now always use egui_glow as a native backend.

Part of https://github.com/emilk/egui/issues/1198
2022-03-11 19:14:27 +01:00
Emil Ernerfeldt 510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
Simon Gardling c19a7ff34f
remove unnecessary to_string in docs (#1345) 2022-03-10 08:23:00 +01:00
mbillingr cd555e07b8
Fix typo: Highligher -> Highlighter (#1346) 2022-03-10 08:14:06 +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 30399bf6ff Update regex crate v1.5.4 -> v1.5.5 2022-03-10 08:08:46 +01:00
Simon Gardling 0e7a4fdbfd
Add method to set a Plot's margin (#1308) 2022-03-08 15:50:53 +01:00
Emil Ernerfeldt d8300037ad
Fix `cargo run -p egui_demo_app` (#1343)
Broken by https://github.com/emilk/egui/pull/1303
2022-03-08 08:26:43 +01:00
Jake Shadle 37c9f116bf
Fix egui_glow when targeting `wasm32-unknown-unknown` (#1303)
* Gate winit/glow and epi correctly

* Add check to CI

* Fix epi cfg
2022-03-07 10:48:40 +01:00
Juan Campa e3d1fa22d1
Fix combo box misalignment on rtl layout (#1304) 2022-03-07 10:48:12 +01:00
Zachary Kohnen 27e179268b
Remove warning about cpal drag and drop (#1329)
* Remove warning about cpal drag and drop

Given that the issue https://github.com/rust-windowing/winit/issues/1255 was closed by https://github.com/rust-windowing/winit/pull/1524, it would make sense to remove the warning about the issue from NativeOptions

* Change `NativeOptions::drag_and_drop_support` default to true
2022-03-07 10:33:59 +01:00
Colin Terry d4bbea3967
egui_extras README grammar fixes (#1313) 2022-03-07 10:14:00 +01:00
Emil Ernerfeldt 833829e3d8 cargo deny: ignore duplicate of hashbrown crate 2022-02-22 19:44:25 +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 83225f46ad Make Bézier demo more compact 2022-02-22 19:12:21 +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 c5a9421dbd
Run wasm-bindgen in CI and update parking_lot (#1293)
* Run wasm-bindgen in CI
* Update parking_lot 0.11 -> 0.12
2022-02-22 16:30:42 +01:00