Commit graph

60 commits

Author SHA1 Message Date
Luis Wirth
c3ac340e25
egui-winit: re-export egui (#1429) 2022-03-28 13:23:07 +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
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
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
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
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +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
6d68838821 Clean up changelogs 2022-02-21 16:10:05 +01:00
Emil Ernerfeldt
ddf914b517
Update crates (#1283)
* Update rfd 0.8 -> 0.8

* Update webbrowser 0.5 -> 0.6

* Update unicode_names2 0.4 -> 0.5

* cargo update

    Updating crates.io index
      Adding arrayvec v0.7.2
    Updating async-lock v2.4.0 -> v2.5.0
    Updating autocfg v1.0.1 -> v1.1.0
    Updating cc v1.0.72 -> v1.0.73
    Updating cfg-expr v0.9.1 -> v0.10.1
    Updating core-foundation v0.9.2 -> v0.9.3
    Updating crc32fast v1.3.1 -> v1.3.2
    Updating crossbeam-epoch v0.9.6 -> v0.9.7
    Updating crossbeam-utils v0.8.6 -> v0.8.7
    Updating deflate v0.9.1 -> v1.0.0
    Removing encoding v0.2.33
    Removing encoding-index-japanese v1.20141219.5
    Removing encoding-index-korean v1.20141219.5
    Removing encoding-index-simpchinese v1.20141219.5
    Removing encoding-index-singlebyte v1.20141219.5
    Removing encoding-index-tradchinese v1.20141219.5
    Removing encoding_index_tests v0.1.4
    Updating enum-map v2.0.1 -> v2.0.2
    Updating futures-core v0.3.19 -> v0.3.21
    Updating futures-io v0.3.19 -> v0.3.21
    Updating futures-sink v0.3.19 -> v0.3.21
    Updating futures-task v0.3.19 -> v0.3.21
    Updating futures-util v0.3.19 -> v0.3.21
    Updating gio-sys v0.15.4 -> v0.15.6
    Updating glib-sys v0.15.4 -> v0.15.6
    Updating gobject-sys v0.15.1 -> v0.15.5
    Updating image v0.24.0 -> v0.24.1
    Updating kurbo v0.8.0 -> v0.8.3
    Updating libc v0.2.117 -> v0.2.119
    Updating memmap2 v0.5.2 -> v0.5.3
      Adding miniz_oxide v0.5.1
      Adding ndk-context v0.1.0
    Removing ndk-glue v0.5.0
    Removing ndk-glue v0.6.0
      Adding ndk-glue v0.5.1
      Adding ndk-glue v0.6.1
    Updating ntapi v0.3.6 -> v0.3.7
    Updating png v0.17.2 -> v0.17.3
    Updating proc-macro-crate v1.1.0 -> v1.1.2
    Updating rand v0.8.4 -> v0.8.5
    Removing rand_hc v0.3.1
    Updating rustls v0.20.2 -> v0.20.4
    Updating semver v1.0.4 -> v1.0.5
    Updating serde_json v1.0.78 -> v1.0.79
    Updating system-deps v6.0.1 -> v6.0.2
    Updating tracing v0.1.30 -> v0.1.31
    Updating tracing-subscriber v0.3.7 -> v0.3.9
    Updating tts v0.20.2 -> v0.20.3
    Removing windows v0.30.0
    Removing windows_aarch64_msvc v0.30.0
    Removing windows_i686_gnu v0.30.0
    Removing windows_i686_msvc v0.30.0
    Removing windows_x86_64_gnu v0.30.0
    Removing windows_x86_64_msvc v0.30.0
2022-02-21 15:40:25 +01:00
Emil Ernerfeldt
cbc53fbe2e eframe: Add epi::NativeOptions::initial_window_pos 2022-02-05 19:12:03 +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
Emil Ernerfeldt
8dfa6ce2f0 Update tts 0.19 -> 0.20 2022-02-04 13:18:03 +01:00
Emil Ernerfeldt
c3be566574
egui-winit: Automatically detect and apply dark or light mode (#1045) 2022-02-02 17:09:36 +01:00
Unknown
270c08a030
min and max window size (#1171) 2022-02-02 16:47:27 +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
b5aaa5fa6f Improve some feature flags 2022-01-31 19:24:56 +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
AlexxxRu
0d00185d9f
Bugfix/drag window (#1108)
Call .drag_window() only after Left mouse btn clicked

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-01-26 22:04:24 +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
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
Erlend Walstad
ab77099781
eframe: allow aborting an exit event (#1038) 2022-01-17 18:45:09 +01:00
Jay Oster
ffa1b6bd43
egui-winit: re-enable window transparency (#1126)
`winit` 0.26.1 fixes the crash on Windows 11
2022-01-17 14:32:16 +01:00
Emil Ernerfeldt
c713fd98dd Fix horizontal scrolling direction on Linux
Closes https://github.com/emilk/egui/issues/356

Work-around until https://github.com/rust-windowing/winit/pull/2105 is merged and released
2022-01-16 09:49:22 +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
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
79cfdaa1f9 Better docs and spelling fixes 2022-01-03 23:58:06 +01:00
Niklas Korz
01015ac94c
Use instant crate in egui-winit for WebAssembly support (#1023)
* Replace `std::time::Instant` with wasm-compatible `instant::Instant`

* Change version requirement for instant to be compatible to winit

* Enable wasm-bindgen feature for instant

* Update lockfile

* Update changelog

* sort dependencies

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-01-03 22:13:53 +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
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
Emil Ernerfeldt
d5efa4bbca 1.56 fix: missing_crate_level_docs -> rusdoc::missing_crate_level_docs 2021-12-26 09:56:14 +01:00
Emil Ernerfeldt
c60d17b91b
Set MSRV to 1.56.0 and use rust edition 2021 (#998) 2021-12-25 19:32:25 +01:00
Aevyrie
c69fe941af
Reverse horizontal scrolling on windows (#966)
* Reverse horizontal scrolling on windows

* Add link to winit issue

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-12-20 23:00:38 +01:00
Jay Oster
dd99f68e82
Update winit to 0.26 (#930)
Also update glium, glutin and rfd
2021-12-20 22:44:53 +01:00
Emil Ernerfeldt
ddd5f6f4f6
winit: don't explicitly handle Cmd-Q and Alt-F4 (#881)
Closes https://github.com/emilk/egui/issues/877

Still a problem: https://github.com/rust-windowing/winit/issues/1998
2021-11-07 20:58:02 +01:00
Emil Ernerfeldt
6d33beabb1 Replace scroll_delta and zoom_delta in RawInput with events
Part of https://github.com/emilk/egui/issues/843
2021-11-03 22:57:13 +01:00
Emil Ernerfeldt
49e43885ff
Replace Context::begin_frame/end_frame with fn run taking a closure (#872)
* Replace Context begin_frame/end_frame with `fn run` taking a closure
* Create `egui::__run_test_ui` to replace `Ui::__test`
* Add helper `egui::__run_test_ctx` for doctests
2021-11-03 20:11:25 +01:00
Emil Ernerfeldt
1dbe608e73
Refactor integrations (#871)
* Unify code in egui_glium and egui_glow into egui_winit::EpiIntegration
* Simplify `EguiGlium` interface
* Simplify `EguiGlow` interface
* egui_web refactor: merge `WebBackend` into `AppRunner`
2021-11-03 13:45:51 +01:00
5225225
461f380a24
egui-winit: Fix shift key getting stuck with shift:both_capslock X11 option set (#849)
Listen for modifiers using ModifiersChanged
2021-11-01 21:34:06 +01:00
Emil Ernerfeldt
08cc07bb2d Release 0.15.0 - Syntax highlighting, hscroll, egui-winit and egui_glow 2021-10-24 16:15:07 +02:00
Caleb Smith
79d1ede496
Add Frame::set_window_title() (#828)
* Add `Frame::set_window_title()`

* Changelog and fmt for `Frame::set_window_title()`

Co-authored-by: Caleb Smith <caleb@myrvmail.com>
2021-10-23 00:03:17 +02:00
sumibi-yakitori
19766bfe4c
Fix when a string containing CRLF is pasted from the clipboard (#826) 2021-10-20 22:26:26 +02:00
Emil Ernerfeldt
d97a369c44 End statements with semicolon (clippy::semicolon_if_nothing_returned) 2021-10-20 16:46:57 +02:00