Commit Graph

2187 Commits

Author SHA1 Message Date
Asger Nyman Christiansen eeeb4b7de2
Improve custom_3d_three-d example (#1923)
* Use correct FBO to output

* custom_3d_three-d web

* Update .gitignore

* Do not free the FBO

* Use three-d 0.13

* ThreeDApp

* Only construct model and camera once

* Clean-up and docs

* Web build instructions

* Remove unused dependencies

* Update Cargo.lock

* Fix build

* More fixes

* omg
2022-08-17 21:33:34 +02:00
Emil Ernerfeldt 39b63f6163 Warn if using an `TextShape` from before a change to pixels_per_point
Closes https://github.com/emilk/egui/issues/1915
2022-08-16 22:47:23 +02:00
Emil Ernerfeldt 9c58f12a6c
eframe: several windows in series (#1919)
* Add example of opening several eframe windows in series

* Reuse the same winit event loop

* Ignore events to the wrong window

* Run run_return again
2022-08-15 16:31:03 +02:00
Zoxc 48e7f219a3
Add CI for android (#1900)
* Add CI for android

* Don't use arboard on Android

* Fix Android support for eframe
2022-08-15 10:19:59 +02:00
Emil Ernerfeldt 923b67ef9c
Update to winit 0.27.2, glutin 0.29.0, glium 0.32 (#1914) 2022-08-14 16:23:46 +02:00
eranfu 38a67f8646
Add `PointerState::button_double_clicked()` and `PointerState::button_triple_clicked()`. (#1907)
Co-authored-by: eranfu <eranfu@tencent.com>
2022-08-14 16:10:38 +02:00
Emil Ernerfeldt 7c25a9238e Remove get_ prefix from functions to better follow Rust API Guidelines 2022-08-08 12:21:53 +02:00
Emil Ernerfeldt e38955fbac Fix: remember to call integration.post_rendering on wgpu path 2022-08-08 12:15:51 +02:00
Emil Ernerfeldt 9e41fa021a eframe: rename `render_state` to `wgpu_render_state` for added clarity 2022-08-08 12:15:31 +02:00
Emil Ernerfeldt 66c601f775
Continue execution after closing native eframe window (#1889)
This adds `NativeOptions::run_and_return` with default value `true`.

If `true`, execution will continue after the eframe window is closed. This is a new behavior introduced in this PR.
If `false`, the app will close once the eframe window is closed. The is the old behavior.

This is `true` by default, and the `false` option is only there so we can revert if we find any bugs.

When `true`, [`winit::platform::run_return::EventLoopExtRunReturn::run_return`](https://docs.rs/winit/latest/winit/platform/run_return/trait.EventLoopExtRunReturn.html#tymethod.run_return) is used. The winit docs warns of its usage, recommending `EventLoop::run`, but 🤷 
When `false`, [`winit::event_loop::EventLoop::run`](https://docs.rs/winit/latest/winit/event_loop/struct.EventLoop.html#method.run) is used.

This is a really useful feature. You can now use `eframe` to quickly open up a window and show some data or options, and then continue your program after the `eframe` window is closed

My previous attempt at this caused some problems, but my new attempt seems to be working much better, at least on my Mac.
2022-08-05 08:20:31 +02:00
Lorren Biffin e3f993d7b4
Fixed bug in custom window example (#1750) 2022-08-04 12:32:27 +02:00
Barugon 2f3c2a360b
Add with_main_align method (#1891)
Co-authored-by: Barugon <barugon@dungeonbox.net>
2022-08-04 12:07:45 +02:00
Emil Ernerfeldt a827c3e033 Add `glow::Painter::intermediate_fbo()`
This allow callbacks to restore to the correct framebuffer
after using their own temporary FBO.

See discussion in https://github.com/emilk/egui/issues/1744
2022-08-03 09:38:46 +02:00
Emil Ernerfeldt 53249d36df Remove superflous #[cfg(test)] 2022-08-03 09:31:43 +02:00
Dylan Ancel 1af446b9e8
Make egui_wgpu::RenderPass Send and Sync (#1883)
* Make RenderPass Send and Sync

* Add change to CHANGELOG

* Make CHANGELOG formatting match egui

* Add test
2022-08-03 09:26:16 +02:00
Emil Ernerfeldt cb0d5a58ab Fix incorrect documentation for `Response::context_menu`
Closes https://github.com/emilk/egui/issues/1882
2022-08-03 08:26:42 +02:00
Asger Nyman Christiansen bcc01c8b1c
Add `egui/default_fonts` feature to `pure_glow` example (#1881)
It seems to me like the `pure_glow` example was broken sometime in april because of changes to feature flags. The text simply didn't show up which is due to missing fonts unless you figured out that you needed the `egui/default_fonts` feature flag. This change enforces the use of the `egui/default_fonts` feature flag in this example.
2022-08-02 23:04:59 +02:00
Nicolas Musset e288ca86fd
Remove dependency on AsRef trait for TextBuffer (#1824) 2022-08-02 20:35:37 +02:00
YgorSouza e39410c37f
Make EasyMark numbered lists allow more than 2 digits (#1826)
Co-authored-by: Ygor Souza <ygor.souza@protonmail.com>
2022-08-02 20:35:25 +02:00
Emil Ernerfeldt 06adb09fa3 Make stick_to_bottom take a bool argument 2022-08-02 20:34:50 +02:00
Emil Ernerfeldt 263c9bd601 Make use of AppRunnerRef
Follow-up to #1650
2022-08-02 17:44:27 +02:00
Stanislav 64496cacb9
Graceful exit from web (#1650)
Return a handle that can be used to stop a running egui instance.
2022-08-02 17:42:55 +02:00
Asger Nyman Christiansen 3eccd341ad
Add depth buffer in native 3D example (#1878)
The `custom_3d_three-d` example does not enable a depth buffer since it is only rendering a triangle. However, if it is used as a starting point for other projects, it is highly likely that a depth buffer is actually needed, therefore I propose to enable it by default.
Also see [this](https://github.com/asny/three-d/issues/268) issue for full context.
2022-08-02 17:31:15 +02:00
Emil Ernerfeldt 10788ccc92
More newlines for improved readability (#1880)
* Add blank lines above all `fn`, `impl`, `struct`, etc
* Even newlines between docstringed struct and enum fields
* Improve some documentation
2022-08-02 17:26:33 +02:00
Emil Ernerfeldt 5d8ef5326b Change `build_demo_web.sh` option from `--fast` to `--optimize` 2022-08-02 09:56:38 +02:00
Emil Ernerfeldt 2500a60062 Code cleanup and improved docs 2022-07-30 18:40:49 +02:00
Kubik 5fb4efa768
Improve documentation about panel order (#1869) 2022-07-30 17:11:56 +02:00
Emil Ernerfeldt d659e5d24f Add `Shape::hline` and `Shape::vline` 2022-07-30 15:34:24 +02:00
Emil Ernerfeldt c62f3409bd Fix misnamed variable (content_is_too_small -> content_is_too_large)
See https://github.com/emilk/egui/issues/1376
2022-07-30 15:33:08 +02:00
quietvoid 8997519eb2
Fix `valign` typo (#1870) 2022-07-30 14:55:34 +02:00
Emil Ernerfeldt 235d77713d Improve README.md files 2022-07-29 16:07:48 +02:00
Emil Ernerfeldt 6de9d89b65 Add emath::exponential_smooth_factor 2022-07-29 16:07:35 +02:00
Emil Ernerfeldt 4e8a6e3370 misc code cleanup 2022-07-29 16:07:26 +02:00
Emil Ernerfeldt b0fa0c65cc fix typo 2022-07-29 15:56:04 +02:00
Emil Ernerfeldt 2612dd1064 Add Visuals::error_fg_color and Visuals::warn_fg_color 2022-07-29 15:32:32 +02:00
Emil Ernerfeldt 8c09804abd
`eframe`: selectively expose parts of the API based on compile target (#1867)
A lot of the `eframe` API is native-only or web-only. With this PR, only the parts that are implemented for each platform is exposed.

This means you'll need to add `#[cfg(target_arch = "wasm32")]` around code that uses the web-parts of the eframe API, and add `#[cfg(not(target_arch = "wasm32"))]` around the parts that are for native/desktop.
2022-07-29 14:37:23 +02:00
Emil Ernerfeldt 51052c08e9 code cleanup: `Pos2::new` -> `pos2`, `Vec2::new` -> `vec2` 2022-07-29 14:34:26 +02:00
Emil Ernerfeldt 105cb4b8f2
eframe: add function to set, query and toggle fullscreen mode (#1866)
Closes https://github.com/emilk/egui/pull/674

Adds `NativeOptions:fullscreen`, `Frame::set_fullscreen` and `WindowInfo::fullscreen`.
2022-07-29 14:21:23 +02:00
Matt Campbell c6c6d2dc5d
Track the global focus state of the UI (#1859)
* Track the global focus state of the UI

* Fix changelog entries

* Document the new difference between `Response::has_focus` and `Memory::has_focus`
2022-07-29 13:15:26 +02:00
zapp88 36a49ffba9
Add dry run feature for anchor calculation. (#1) (#1856)
* Add dry run feature for anchor calculation. (#1)

This PR resolves issue: emilk#1852
We introduce dry_run flag which makes component invisible until we do second pass of rendering - which allows us to properly calculate position for anchor. (This removes rapid flicker when new window is drawn for the first time).

* Change naming convention and add description
2022-07-29 13:14:28 +02:00
Emil Ernerfeldt 278db1c94b
Fix plot auto bounds (#1865)
* Better estimate the plot bounds for generator functions

Avoid infinities, and sample more densely

* Optimize and improve plot auto-bounds logic

* Fix cropping out of the top/bottom of plots during auto-bounds
2022-07-29 12:32:47 +02:00
Emil Ernerfeldt 97880e18d7 Make egui_demo_app native window size larger by default 2022-07-29 11:14:37 +02:00
Matt Campbell b3ab31953e
Fix focus behavior when pressing Tab with no focus (#1861) 2022-07-29 10:42:09 +02:00
Emil Ernerfeldt 09d636b089 egui-wgpu: correctly handle viewport rectangle for callbacks
This is important for when a callback shape is inside a ScrollArea.
2022-07-29 00:06:08 +02:00
Connor Fitzgerald 0571bf67e2
Reset the scissor rect after rendering onto a renderpass (#1858) 2022-07-27 01:09:19 +02:00
Matt Campbell 7a46a23db5
Update MSRV to Rust 1.61.0 (#1846) 2022-07-26 16:50:53 +02:00
Emil Ernerfeldt 2278128e66 Add bacon.toml for https://github.com/Canop/bacon 2022-07-26 11:21:57 +02:00
Emil Ernerfeldt 8e2de26e4e Enable more clippy lints 2022-07-26 11:18:21 +02:00
Emil Ernerfeldt a7012cf8a6
Use pinned version of wasm-bindgen-cli (#1855)
* Use pinned version of wasm-bindgen-cli

* Update wasm-bindgen to 0.2.82

* Call setup_web.sh from scripts that depends on it
2022-07-25 23:02:10 +02:00
Adam Gąsior 36cdae98df
Add methods for custom number formatting in `DragValue` and `Slider` (#1851) 2022-07-25 22:38:24 +02:00