Commit graph

31 commits

Author SHA1 Message Date
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
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
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
5c68edbb15 Clippy fixes 2022-03-21 22:14:25 +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
c3fc8997d6
Introduce egui_extras with RetainedImage for loading svg,png,jpeg,… (#1282) 2022-02-21 15:26:26 +01:00
Emil Ernerfeldt
89d19860b8 Misc code cleanup, docs fixes, etc 2022-02-19 20:58:28 +01:00
Emil Ernerfeldt
defc400c21
Add an example of how to display an SVG image in egui (#1228) 2022-02-09 08:12:12 +01:00
Emil Ernerfeldt
47038c631e Update image 0.23 -> 0.24 2022-02-04 13:31:06 +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
Erlend Walstad
ab77099781
eframe: allow aborting an exit event (#1038) 2022-01-17 18:45:09 +01:00
Emil Ernerfeldt
b2c8cd0867 Simplify http demo and add new download_image eframe demo 2022-01-15 20:34:03 +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
Emil Ernerfeldt
753d709d3d
Hide console on windows for all examples in release builds (#1008) 2021-12-30 22:43:53 +01:00
Emil Ernerfeldt
f779e8a346 Add an eframe example of how to install a custom font 2021-12-29 21:43:37 +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
647e020824 file_dialogs example: remove macos exemption
this got fixed in the latest winit upgrade
2021-12-26 18:13:29 +01:00
Emil Ernerfeldt
76cdbe2cf8 Add better documentation for epi::NativeOptions::drag_and_drop_support
Closes https://github.com/emilk/egui/issues/747
2021-09-30 19:40:21 +02:00
Emil Ernerfeldt
3e1db880dc
Revert change to winit event loop in egui_glium (#756)
* Revert change to winit event loop in egui_glium

This reverts https://github.com/emilk/egui/pull/631

Fixes https://github.com/emilk/egui/issues/755

* Add example of file dialogs and file drag-and-drop

* fix ci
2021-09-30 18:53:41 +02:00
Emil Ernerfeldt
a5a5d6176d Improve the frame around ImageButton
Helps https://github.com/emilk/egui/issues/721
2021-09-20 22:37:21 +02:00
Emil Ernerfeldt
6902151a96 Add example of loading and showing an image with eframe/egui
Closes https://github.com/emilk/egui/pull/700
2021-09-04 17:44:01 +02:00
Emil Ernerfeldt
7374ed9d00 epi/eframe: move options out of trait App into new NativeOptions 2021-05-08 10:14:56 +02:00
Emil Ernerfeldt
de439b6e21 Deprecate old Slider constructors in favor of Slider::new 2021-03-27 16:07:18 +01:00
Emil Ernerfeldt
247026149c
Multiple mouse button support (#135)
Add support for primary, secondary and middle mouse buttons. Also improve ability to click things in low FPS situations.

This introduces a lot of breaking changes:

    Backends/integrations now pass mouse events via the even stream.
    Response has an interface of mostly methods instead of public members.
    input.mouse is now input.pointer and has new interface.


* Rename 'mouse' to 'pointer' everywhere (pointer = mouse or touch)

* Make Response::clicked and Response::double_clicked into methods

* Remove Response::active and add dragged() and interact_pointer_pos()

* Support multiple mouse buttons

* Make PointerState interface all methods

* Make most members of Response private
2021-01-25 18:50:19 +01:00
Emil Ernerfeldt
31b7eda51e Rename Egui to egui
Also update iamges in README.md
2021-01-17 14:48:59 +01:00
Emil Ernerfeldt
4202c4b6a9 Add an eframe example app 2021-01-02 13:18:21 +01:00