Commit graph

2229 commits

Author SHA1 Message Date
Emil Ernerfeldt
46279dbd09 ahash: replace runtime-rng with compile-time-rng
https://github.com/emilk/egui/issues/2009
2022-09-07 16:27:27 +02:00
Luis Wirth
4b6826575e
egui-wgpu renderer renaming (#2021)
- `RenderPass` -> `Renderer`
- `RenderPass::execute` -> `Renderer::render`
- `RenderPass::execute_with_renderpass` -> `Renderer::render_onto_renderpass`
- reexport `Renderer` in `lib.rs`
2022-09-07 14:20:21 +02:00
bigfarts
0e62c0e50b
Improve mixed CJK/Latin linebreaking. (#1986) 2022-09-06 22:20:17 +02:00
Emil Ernerfeldt
5500895845
eframe: make sure we save app state on Cmd-Q (#2013)
Cmd-Q emits a `winit::event::Event::LoopDestroyed` and then the app closes, without `run_return` returning (despite its name).
2022-09-06 16:07:58 +02:00
Adia Robbie
eeb97fa4ce
Check srgb_support on other GL | ES as well. (#2012) 2022-09-06 15:58:22 +02:00
Romet Tagobert
64aac30f36
Add depth buffer support for egui-wgpu's render pass (#2002)
* add a depth texture for wgpu callbacks

* egui-wgpu: use depth from native_options

* add wgpu caveat to depth_buffer docstring
2022-09-06 14:37:07 +02:00
ComLarsic
162210f90e
Add sdl2_egui_platform to the list of integrations (#2011) 2022-09-06 14:28:59 +02:00
Adia Robbie
b43a8626cf
Add custom shader_version on glow renderer (#1993)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-06 10:08:16 +02:00
Luke Jones
7fae634dc3
egui_glow: default to RGBA8 if sRGB not supported (#2007)
The Vivante GPU on many STM32MP1 based boards does not support sRGB
as an internal format.

Introduce a check for sRGB support and default to `RGBA8` internal format
if not supported.

Additionally the STM32MP1 needs to be checked for `GL_ARB_vertex_array_object`

Closes #1991
2022-09-06 10:07:49 +02:00
Emil Ernerfeldt
1d5f20b46c Improve docstrings
Closes https://github.com/emilk/egui/issues/2001
2022-09-05 12:05:29 +02:00
njust
124ed5e4ba
Fixed typo (#1990)
* Fixed typo

* fix grammar too

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-05 12:02:31 +02:00
RadonCoding
613a664c45
Fixed a typo (#1985)
custom_window_frame was spelled as custon_window_frame
2022-08-30 10:12:52 +02:00
Koute
be9f363c53
egui_winit: support winit with default features disabled (#1971)
* egui_winit: support winit with default features disabled

* Link to the PR in the changelog
2022-08-30 08:49:32 +02:00
Joshua Batty
153524023f
egui-wgpu: port over missing update_wgpu_texture methods from egui_wgpu_backend (#1981)
* add back missing update_egui_texture_from_wgpu_texture methods to renderer module

* clippy
2022-08-29 14:09:34 +02:00
Emil Ernerfeldt
ac4d75e9b4
egui-winit: don't repaint when just moving window (#1980)
* Bug fix: reset repaint countdown when we pass it

* eframe: debug-print what winit event caused a repaint

* egui-winit: don't repaint when only moving window

* fix docstring
2022-08-29 11:20:19 +02:00
Adam Gąsior
9b2c3d1026
Add custom parser to DragValue and Slider, with additional support for binary, octal, and hexadecimal numbers. (#1967)
* Add `custom_parser` to `DragValue`

* Add `custom_parser` to `Slider`

* Add `binary_u64`, `octal_u64`, and `hexadecimal_u64` to `DragValue`

* Add `binary_u64`, `octal_u64`, and `hexadecimal_u64` to `Slider`

* Fix formatting and errors in docs

* Update CHANGELOG.md

* Fix CI errors

* Replace manual number parsing with i64::from_str_radix. Add support for signed integers.

* Update CHANGELOG.md

* Change documentation.

* Fix documentation.

* Fix documentation.

* Remove unnecessary links.
2022-08-28 18:16:12 +02:00
Emil Ernerfeldt
3142c52b94
Minor wgpu-web releated stuff (#1977)
* egui_demo_app: remove wgpu and pollster as direct dependencies

* eframe: use same web-sys version as wgpu crate

* Make note that web_sys_unstable_apis is required by the wgpu crate

* Rename the glow web painter in eframe

* Remove trait DummyWebGLConstructor from web_glow_painter.rs

* cargo fmt

* Fix check.sh
2022-08-28 10:58:58 +02:00
njust
dbfaa4527b
egui_extras: Add Table::vertical_scroll_offset (#1946)
* egui_extras: Add Table::vertical_scroll_offset

* Added example for TableBuilder::vertical_scroll_offset

* Format code

* Add link to PR in the changelog

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-08-28 09:37:23 +02:00
MaximOsipenko
af63101fdc
eliminate some possible deadlocks (#1968) 2022-08-28 09:36:23 +02:00
Zoxc
9be060fe69
Allow cursors to be linked for plots (#1722)
* Allow cursors to be linked

* Link cursors in demo

* Refactor cursor memory to deal with removal of plots

* Refactor PlotItem::on_hover to produce a list of cursors

* Use a separate `LinkedCursorsGroup` type to link cursors.

* Refactor `Cursor`.

* Inline `push_argument_ruler` and `push_value_ruler`.

* Update documentation

* Update doc reference
2022-08-28 09:36:08 +02:00
Emil Ernerfeldt
b978b06159
Simplify, clean up and speed up CI (#1970)
Use https://github.com/Swatinem/rust-cache
2022-08-27 09:54:47 +02:00
Tomáš Král
f3f6946eb2
egui_glium correct texture filtering (#1962)
* correct texture filter in egui_glium

* update example

* cargo fmt

* rename UserTexture
2022-08-25 08:05:58 +02:00
Emil Ernerfeldt
d5933daee5 egui_glow: allow empty (zero-sized) textures
See https://github.com/emilk/egui/issues/1960
2022-08-24 14:34:34 +02:00
Robert Bragg
fb92434aac
Android support for EFrame (#1952)
* eframe: allow hooking into EventLoop building

This enables native applications to add an `event_loop_builder` callback
to the `NativeOptions` struct that lets them modify the Winit
`EventLoopBuilder` before the final `EventLoop` is built and run.

This makes it practical for applications to change platform
specific config options that Egui doesn't need to be directly aware of.

For example the `android-activity` glue crate that supports writing
Android applications in Rust requires that the Winit event loop be
passed a reference to the `AndroidApp` that is given to the
`android_main` entrypoint for the application.

Since the `AndroidApp` itself is abstracted by Winit then there's no
real need for Egui/EFrame to have a dependency on the `android-activity`
crate just for the sake of associating this state with the event loop.

Addresses: #1951

* eframe: defer graphics state initialization until app Resumed

Conceptually the Winit `Resumed` event signifies that the application is
ready to run and render and since
https://github.com/rust-windowing/winit/pull/2331 all platforms now
consistently emit a Resumed event that can be used to initialize
graphics state for an application.

On Android in particular it's important to wait until the application
has Resumed before initializing graphics state since it won't have an
associated SurfaceView while paused.

Without this change then Android applications are likely to just show
a black screen.

This updates the Wgpu+Winit and Glow+Winit integration for eframe but
it's worth noting that the Glow integration is still not able to fully
support suspend and resume on Android due to limitations with Glutin's
API that mean we can't destroy and create a Window without also
destroying the GL context, and therefore (practically) the entire
application.

There is a plan (and progress on) to improve the Glutin API here:
https://github.com/rust-windowing/glutin/pull/1435 and with that change
it should be an incremental change to enable Android suspend/resume
support with Glow later.

In the mean time the Glow changes keep the implementation consistent
with the wgpu integration and it should now at least be possible to
start an Android application - even though it won't be able to suspend
correctly.

Fixes #1951
2022-08-23 14:43:22 +02:00
Zoxc
b9bb7baaa7
Only require something GLES 3 compatible from wgpu (#1956) 2022-08-23 14:39:01 +02:00
Daniel Buch Hansen
4629f2cd12
Example: three-d downgrade depth_buffer to 24 bit (#1950)
Closes: #1949
2022-08-21 19:23:34 +02:00
Emil Ernerfeldt
8797c02ed9 Publish new web demo that works on Es100 2022-08-20 19:55:54 +02:00
Emil Ernerfeldt
bd5250f85d
Disable custom 3D painting example in the egui demo app for Es100 (#1945)
Closes https://github.com/emilk/egui/issues/1944
2022-08-20 19:54:18 +02:00
Emil Ernerfeldt
97ce103209 Release 0.19.0 - wgpu backend, repaint_after, continue-after-close 2022-08-20 16:49:58 +02:00
Emil Ernerfeldt
13f5d62b4b Commit a new web demo 2022-08-20 16:37:59 +02:00
Emil Ernerfeldt
127931ba45
eframe: rename quit/exit to "close" (#1943)
Since https://github.com/emilk/egui/pull/1919 we can continue
the application after closing the native window. It therefore makes
more sense to call `frame.close()` to close the native window,
instead of `frame.quit()`.
2022-08-20 16:08:59 +02:00
Emil Ernerfeldt
2453756782 Fix broken GitHub source links due to #1940 2022-08-20 15:18:02 +02:00
Emil Ernerfeldt
8737933101 Improve documentation and logging 2022-08-20 15:06:43 +02:00
Emil Ernerfeldt
725aa5277b Update crate rfd to 0.10 (in file_dialog example)
Also update ab_glyph from 0.2.15 to 0.2.16
2022-08-20 14:42:37 +02:00
Emil Ernerfeldt
eb10ef94f7 Build-fix for --no-default-features 2022-08-20 14:40:33 +02:00
Emil Ernerfeldt
f4cc1c5465
eframe: Don't follow system theme by default (#1941)
I have gone back and forth on this a bit, but I think the arguments
AGAINST following the system theme are many:

* `dark-light` is a big dependency with problems on Linux.
* Many people prefer the dark mode and ask how to set it as the default
  (even though they are using light mode in their OS).
* A developer may be surprised when the app changes theme when
  they run it on another computer.

So, the path of least surprise is to make this an opt-in feature
with dark mode as the default mode.

On native, you add the `dark-light` feature to enable it.
On web, you set `WebOptions::follow_system_theme`.
2022-08-20 11:11:07 +02:00
Emil Ernerfeldt
40e440b2f7 Update changelog with recent PR merges 2022-08-20 10:42:31 +02:00
Emil Ernerfeldt
041f2e64ba
Move all crates into a crates directory (#1940) 2022-08-20 10:41:49 +02:00
Emil Ernerfeldt
5c63648c02
clean up rust.yml (#1939) 2022-08-20 09:32:48 +02:00
Emil Ernerfeldt
193a434717 eframe persistence: persistence failure is now logged instead of a panic 2022-08-19 12:04:43 +02:00
Emil Ernerfeldt
277f199df4 eframe: make sure we can serialize i128/u128 with ron
Some eframe users may be relying on this.
2022-08-19 12:04:08 +02:00
Emil Ernerfeldt
5514a8afda
Update dependencies (#1933)
* Update ahash from 0.7 to 0.8

Opt to use ahash::HashMap over ahash::AHashMap

* Fix ahash compilation for web

* Update ron to 0.8

* Add note about why we cannot update tiny-skia

* cargo update

    Updating crates.io index
    Updating android_system_properties v0.1.2 -> v0.1.4
    Updating anyhow v1.0.58 -> v1.0.62
    Updating async-broadcast v0.4.0 -> v0.4.1
    Updating async-channel v1.6.1 -> v1.7.1
    Updating async-io v1.7.0 -> v1.8.0
    Updating async-task v4.2.0 -> v4.3.0
    Updating async-trait v0.1.56 -> v0.1.57
    Updating backtrace v0.3.65 -> v0.3.66
    Updating bit-set v0.5.2 -> v0.5.3
    Updating bumpalo v3.10.0 -> v3.11.0
    Updating bytemuck v1.10.0 -> v1.12.1
    Updating bytemuck_derive v1.1.0 -> v1.2.1
    Updating bytes v1.1.0 -> v1.2.1
    Updating cast v0.2.7 -> v0.3.0
    Updating chrono v0.4.19 -> v0.4.22
    Updating clap v3.2.8 -> v3.2.17
    Updating clipboard-win v4.4.1 -> v4.4.2
    Updating combine v4.6.4 -> v4.6.6
    Updating concurrent-queue v1.2.2 -> v1.2.4
    Updating criterion v0.3.5 -> v0.3.6
    Updating criterion-plot v0.4.4 -> v0.4.5
    Updating crossbeam-channel v0.5.5 -> v0.5.6
    Updating crossbeam-deque v0.8.1 -> v0.8.2
    Updating crossbeam-epoch v0.9.9 -> v0.9.10
    Updating crossbeam-utils v0.8.10 -> v0.8.11
    Updating document-features v0.2.1 -> v0.2.3
    Updating dyn-clone v1.0.6 -> v1.0.9
    Removing easy-parallel v3.2.0
    Updating either v1.7.0 -> v1.8.0
    Updating enum-map v2.1.0 -> v2.4.1
    Updating enum-map-derive v0.8.0 -> v0.10.0
    Updating event-listener v2.5.2 -> v2.5.3
    Updating fastrand v1.7.0 -> v1.8.0
    Updating futures-core v0.3.21 -> v0.3.23
    Updating futures-io v0.3.21 -> v0.3.23
    Updating futures-sink v0.3.21 -> v0.3.23
    Updating futures-task v0.3.21 -> v0.3.23
    Updating futures-util v0.3.21 -> v0.3.23
    Updating gimli v0.26.1 -> v0.26.2
    Updating gpu-descriptor v0.2.2 -> v0.2.3
    Removing hashbrown v0.11.2
    Removing hashbrown v0.12.1
      Adding hashbrown v0.12.3
      Adding iana-time-zone v0.1.46
    Updating image v0.24.2 -> v0.24.3
    Updating inplace_it v0.3.3 -> v0.3.4
    Updating itoa v1.0.2 -> v1.0.3
    Updating js-sys v0.3.58 -> v0.3.59
    Updating libc v0.2.126 -> v0.2.132
    Updating libm v0.2.2 -> v0.2.5
    Removing memmap2 v0.3.1
    Removing memmap2 v0.5.4
      Adding memmap2 v0.5.7
    Removing num-iter v0.1.43
    Updating object v0.28.4 -> v0.29.0
    Updating once_cell v1.13.0 -> v1.13.1
    Updating os_str_bytes v6.1.0 -> v6.3.0
    Updating owned_ttf_parser v0.15.0 -> v0.15.1
    Removing parking_lot v0.11.2
    Removing parking_lot_core v0.8.5
    Updating plotters v0.3.1 -> v0.3.3
    Updating plotters-backend v0.3.2 -> v0.3.4
    Updating plotters-svg v0.3.1 -> v0.3.3
    Updating proc-macro-crate v1.1.3 -> v1.2.1
    Updating proc-macro2 v1.0.40 -> v1.0.43
    Updating quote v1.0.20 -> v1.0.21
    Updating redox_syscall v0.2.13 -> v0.2.16
    Updating regex v1.5.6 -> v1.6.0
    Updating regex-syntax v0.6.26 -> v0.6.27
    Updating rfd v0.8.0 -> v0.8.4
    Removing rustc_version v0.4.0
    Updating ryu v1.0.10 -> v1.0.11
    Updating sctk-adwaita v0.4.1 -> v0.4.2
    Removing semver v1.0.12
    Updating serde v1.0.138 -> v1.0.143
    Updating serde_derive v1.0.138 -> v1.0.143
    Updating serde_json v1.0.82 -> v1.0.83
    Updating serde_repr v0.1.8 -> v0.1.9
    Updating slab v0.4.6 -> v0.4.7
    Removing smithay-client-toolkit v0.15.4
    Updating smithay-clipboard v0.6.5 -> v0.6.6
    Updating syn v1.0.98 -> v1.0.99
    Updating thiserror v1.0.31 -> v1.0.32
    Updating thiserror-impl v1.0.31 -> v1.0.32
    Updating time v0.3.11 -> v0.3.13
      Adding tiny-skia v0.7.0
      Adding tiny-skia-path v0.7.0
    Updating tracing v0.1.35 -> v0.1.36
    Updating tracing-core v0.1.28 -> v0.1.29
    Updating tracing-subscriber v0.3.14 -> v0.3.15
    Updating unicode-ident v1.0.1 -> v1.0.3
    Updating unicode_names2 v0.5.0 -> v0.5.1
    Updating ureq v2.4.0 -> v2.5.0
    Updating wasm-bindgen-futures v0.4.31 -> v0.4.32
    Updating web-sys v0.3.58 -> v0.3.59
    Updating webpki-roots v0.22.3 -> v0.22.4
    Updating weezl v0.1.6 -> v0.1.7
    Updating wgpu-core v0.13.1 -> v0.13.2
    Updating wgpu-hal v0.13.1 -> v0.13.2
    Updating wgpu-types v0.13.0 -> v0.13.2
    Updating windows v0.32.0 -> v0.37.0
    Updating windows_aarch64_msvc v0.32.0 -> v0.37.0
    Updating windows_i686_gnu v0.32.0 -> v0.37.0
    Updating windows_i686_msvc v0.32.0 -> v0.37.0
    Updating windows_x86_64_gnu v0.32.0 -> v0.37.0
    Updating windows_x86_64_msvc v0.32.0 -> v0.37.0
    Updating x11-dl v2.19.1 -> v2.20.0
    Updating zbus_names v2.1.0 -> v2.2.0
    Updating zvariant v3.4.1 -> v3.6.0
    Updating zvariant_derive v3.4.1 -> v3.6.0

* Add "Unicode-DFS-2016" to deny.toml whitelist
2022-08-19 11:46:38 +02:00
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