Commit graph

2247 commits

Author SHA1 Message Date
Emil Ernerfeldt
a38123f46e Make weak_text_color an Option 2022-10-01 14:21:35 +02:00
Emil Ernerfeldt
fa51e01076 Add ability to pick color of weak text with Visual::weak_text_color 2022-10-01 08:22:20 +02:00
Emil Ernerfeldt
2ee9ab3151 Added link to egui-glutin-gl 2022-09-27 23:08:43 +02:00
Emil Ernerfeldt
91b2d5da6f Fix typo in wgpu warning message 2022-09-25 16:46:40 +02:00
Emil Ernerfeldt
4ac1e28eae
Improve text redering and do all color operation in gamma space (#2071) 2022-09-24 17:53:11 +02:00
Emil Ernerfeldt
29fa63317e
Fix text sizes being too small (#2069)
Closes https://github.com/emilk/egui/issues/2068

Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!

The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.

If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.

This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
2022-09-21 21:31:08 +02:00
Emil Ernerfeldt
990a8c8b44
Fix sRGB blending and cleanup the relevant code (#2070)
* Fix sRGBA blending on Mac

* Clean up handling of sRGB support

* Assume sRGB support if any extension has sRGB in it

* improve logging very slightly
2022-09-21 21:30:02 +02:00
setzer22
4aae638e15
Change several methods from pub(crate) to pub (#2051)
* Change several methods from pub(crate) to pub

* document next_auto_id

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-21 20:08:26 +02:00
Emil Ernerfeldt
12dc61ed0f
update arboard to 3.0 (#2067) 2022-09-21 09:14:55 +02:00
Emil Ernerfeldt
2b0bf82b51
Make eframe::App::as_any_mut optional to implement (#2061) 2022-09-20 13:58:55 +02:00
Chris Hamons
311eb66cae
Add spacing.menu_margin for customizing menu spacing (#2036)
- Fixes https://github.com/emilk/egui/discussions/287
2022-09-17 11:29:19 +02:00
Adia Robbie
bc6a823103
eframe: Add center to NativeOptions and monitor_size to WindowInfo (#2035)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-17 11:20:40 +02:00
Paul Rouget
c4117066cf
MacOS: Support fullsize content (no titlebar, but window controls) (#2049)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-16 14:31:21 +02:00
Sheldon Nico
0605bcfca7
Add IME support for native (#2046) 2022-09-15 17:21:43 +02:00
Emil Ernerfeldt
c5495d69fb
egui-wgpu: Fix crash on zero-sized scissor rects (#2039) 2022-09-13 09:32:05 +02:00
Zoxc
2842d390c9
Allow box zoom in any direction (#2028) 2022-09-09 08:30:14 +02:00
Stanislav
ebc4fc866d
eframe web: access app from WebHandle (#1886)
Co-authored-by: Stanislav <enomado@users.noreply.github.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-09 08:22:46 +02:00
Emil Ernerfeldt
e0c7533ede eframe native: Make sure we only shut down once
I don't trust winit to actually exit on ControlFlow::Exit

Perhaps this will solve https://github.com/emilk/egui/issues/2027
2022-09-08 10:50:35 +02:00
Emil Ernerfeldt
1fe08bf7e4 eframe: reduce repaint log level from debug to trace 2022-09-07 16:27:53 +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