optozorax / egui-macroquad Goto Github PK
View Code? Open in Web Editor NEWegui bindings for macroquad
Home Page: https://optozorax.github.io/egui-macroquad/
License: Apache License 2.0
egui bindings for macroquad
Home Page: https://optozorax.github.io/egui-macroquad/
License: Apache License 2.0
Is it possible for equi-macroquad to use the current macroquad camera settings? Ideally it would use the camera's zoom/rotation/etc, but most important is the current camera's render_target.
I want to be able to render egui to a texture, but it's not currently possible with egui-macroquad.
I tried many options to make the lines not wrap, but nothing worked
Some features i would like to use in the new egui version are not supported in here. Are there any workarounds?
egui_macroquad::ui(|egui_ctx| {
egui::Window::new("egui ❤ macroquad")
.show(egui_ctx, |ui| {
ui.label("Test");
});
});
the error is as follows :
mismatched types
`egui_macroquad::egui::Context` and `egui::context::Context` have similar names, but are actually distinct types
perhaps two different versions of crate `egui` are being used?rustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B6%5D?6#file%3A%2F%2F%2Fhome%2Fvega%2FCoding%2FTraining%2Ftrying-wasm-macroquad%2Fapp%2Fsrc%2Fmain.rs)
main.rs(34, 35): arguments to this method are incorrect
context.rs(225, 1): `egui_macroquad::egui::Context` is defined in crate `egui`
context.rs(684, 1): `egui::context::Context` is defined in crate `egui`
demo_app_windows.rs(176, 12): method defined here
the egui_ctx is defined both in the egui crate and the macroquad egui binding.
Fiddling with the versions of egui does not fix it.
There is no example toml, but I have tried every variation of importing egui, no egui, just this library, the egui-miniquad lib, etc.
The egui_ctx type is ambiguous to rustc. Even with explicit importing of egui from this library, it still mows over the egui_ctx definition.
When working on a tool or a game, you usually want to avoid doing x action if you clicked a widget instead of the canvas. If for example I have a painting app and there is an egui windows on top, you don't want to draw on the canvas when you click or drag the egui windows, the egui windows should "block" that input or at least allow you to know that happened
Hi
As far as I understood, this crate is designed to internally include macroquad
as its own dependency (most probably to ensure nothings breaks) and therefore the user of egui-macroquad
are not supposed to add both macroquad
and egui-macroquad
as dependencies.
Meaning, this is not going to work (it causes a panic in my case)
[dependencies]
macroquad = "0.4.5" # or its variants, like { version = "0.4.5", default-features = false }
egui-macroquad = "0.15.0"
If so, what's the process of updating egui-macroquad
to use more recent versions of macroquad
? As of now, egui-macroquad
depends onmacroquad 0.3.x
while 0.4.x
is out for a while.
Hello,
I'm trying to use Context.set_pixels_per_point don't work function, but it has no effect. Example :by modifying README example :
egui_macroquad::ui(|egui_ctx| {
egui::Window::new("egui ❤ macroquad").show(egui_ctx, |ui| {
ui.ctx().set_pixels_per_point(2.0);
ui.label("Test");
});
});
Note : I tried to call it with egui_macroquad::cfg(|egui_cfg| egui_cfg.set_pixels_per_point(2.0));
without effect too.
Do you know why it has no effect ?
Lines 22 to 23 in dfbdb96
However, not-fl3/egui-miniquad#65 has been merged, so we can use the crates.io version now.
Currently I need to manually add egui as a dependency to my project, this has the con that a new version of egui might be released that has some breaking changes and I might update to it before this crate gets a chance to update, which could cause headaches
Alternatively maybe mention in the README that egui needs to be listed as a dependecy and which egui version you support
Hi guys! Tried to build demo example using on MacOs 12.4, but it fails with 3 errors:
error[E0277]: expected a FnOnce<(&egui::Context,)>
closure, found F
--> src/lib.rs:81:37
|
81 | self.0.run(gl.quad_context, f);
| --- ^ expected an FnOnce<(&egui::Context,)>
closure, found F
| |
| required by a bound introduced by this call
|
= note: expected a closure taking 2 arguments, but one taking 1 argument was given
note: required by a bound in EguiMq::run
--> /Users/*/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/lib.rs:145:66
|
145 | pub fn run(&mut self, mq_ctx: &mut mq::Context, run_ui: impl FnOnce(&egui::Context)) {
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in EguiMq::run
error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> src/lib.rs:113:16
|
113 | self.0.mouse_motion_event(x, y);
| ^^^^^^^^^^^^^^^^^^ - - supplied 2 arguments
| |
| expected 3 arguments
|
note: associated function defined here
--> /Users/*/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/lib.rs:204:12
|
204 | pub fn mouse_motion_event(&mut self, ctx: &mut mq::Context, x: f32, y: f32) {
| ^^^^^^^^^^^^^^^^^^
error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> src/lib.rs:117:16
|
117 | self.0.mouse_wheel_event(dx, dy);
| ^^^^^^^^^^^^^^^^^ -- -- supplied 2 arguments
| |
| expected 3 arguments
|
note: associated function defined here
--> /Users/*/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/lib.rs:210:12
|
210 | pub fn mouse_wheel_event(&mut self, _ctx: &mut mq::Context, dx: f32, dy: f32) {
| ^^^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0061, E0277.
For more information about an error, try rustc --explain E0061
.
error: could not compile egui-macroquad
due to 3 previous errors
Egui has various functionality that deals with textures, like Ui::image.
However, egui-macroquad doesn't seem to expose any functionality to upload or share textures between macroquad and egui.
macroquad::texture::Texture2D
cannot be used as an egui::TextureId
, nor does it implement Into<egui::ImageData>
. The same seems true for macroquad::texture::Image
.
Is it possible to share/upload texture data to egui with egui-macroquad, and if so, how?
It's a bit out of date =)
Could you set it to use "any version above ..." rather than use an explicit version? That way it would work with all current and future versions of Macroquad!
I will be saying menubutton in this post, but it applies to comboboxes as well, and probably anything that opens a drop-down menu. If you open the menubutton, you can select options from the drop-down menu. If you click outside this menu, it closes. Simple stuff. My issue is that the menubutton works fine if you click in the same Egui window to close it, but if you click anywhere else, you can no longer interact with not just the menubutton, but anything in that Egui window. Not like it gets disabled, it looks just fine, you just can't click it. I can send code if needed, I don't think it's too necessary. Any ideas? Thanks!
When I run any code containing egui-macroquad
in the browser and press Ctrl+V while focused on the tab, this panic message shows up:
__rust_start_panic http://192.168.131.1:5500/test-macroquad.wasm:3429188
rust_panic http://192.168.131.1:5500/test-macroquad.wasm:3428830
_ZN3std9panicking20rust_panic_with_hook17h7f7102b82d51338fE http://192.168.131.1:5500/test-macroquad.wasm:3428782
_ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hfa40135feb109919E http://192.168.131.1:5500/test-macroquad.wasm:3425999
_ZN3std10sys_common9backtrace26__rust_end_short_backtrace17haf21bfec9a028e09E http://192.168.131.1:5500/test-macroquad.wasm:3425785
rust_begin_unwind http://192.168.131.1:5500/test-macroquad.wasm:3427845
_ZN4core9panicking9panic_fmt17he4489d678d6570d5E http://192.168.131.1:5500/test-macroquad.wasm:3434746
_ZN4core6result13unwrap_failed17h9c69c0d7a98df92bE http://192.168.131.1:5500/test-macroquad.wasm:3462620
_ZN4core4cell16RefCell$LT$T$GT$10borrow_mut17hda5025488c241312E http://192.168.131.1:5500/test-macroquad.wasm:3295170
_ZN8miniquad6native4wasm4with28_$u7b$$u7b$closure$u7d$$u7d$17h7f08ef7c9a448612E http://192.168.131.1:5500/test-macroquad.wasm:3280304
_ZN3std6thread5local17LocalKey$LT$T$GT$8try_with17hf0d05f030ea6738bE http://192.168.131.1:5500/test-macroquad.wasm:3369544
_ZN3std6thread5local17LocalKey$LT$T$GT$4with17hc12f374a194061ffE http://192.168.131.1:5500/test-macroquad.wasm:3369039
_ZN8miniquad6native4wasm4with17h8863287470a1b6c5E http://192.168.131.1:5500/test-macroquad.wasm:3274382
_ZN8miniquad6native4wasm13clipboard_get17hbf8d39f335b462f6E http://192.168.131.1:5500/test-macroquad.wasm:3272280
NativeDisplay$GT$13clipboard_get17hc6454bcfbf2202b9E http://192.168.131.1:5500/test-macroquad.wasm:3272249
GraphicsContext$GT$13clipboard_get17hb44edb72a06f2e14E http://192.168.131.1:5500/test-macroquad.wasm:3348531
_ZN13egui_miniquad6EguiMq13get_clipboard17h6016c76bf0af6f31E http://192.168.131.1:5500/test-macroquad.wasm:48761
_ZN13egui_miniquad6EguiMq14key_down_event17h2ca14903404c9129E http://192.168.131.1:5500/test-macroquad.wasm:47925
EventHandler$GT$14key_down_event17hc7c25588739afaf7E http://192.168.131.1:5500/test-macroquad.wasm:36038
_ZN9macroquad18MiniquadInputEvent6repeat17hfa24844789bae264E http://192.168.131.1:5500/test-macroquad.wasm:19287
_ZN9macroquad5input5utils25repeat_all_miniquad_input17h1a1b5af7514cfa00E http://192.168.131.1:5500/test-macroquad.wasm:30493
_ZN14egui_macroquad4Egui2ui17h2c86c8cd94949edbE http://192.168.131.1:5500/test-macroquad.wasm:23726
_ZN14egui_macroquad2ui17h86968250b455441dE http://192.168.131.1:5500/test-macroquad.wasm:23612
_ZN14test_macroquad5amain28_$u7b$$u7b$closure$u7d$$u7d$17hef8740485354ed6dE http://192.168.131.1:5500/test-macroquad.wasm:15531
_ZN9macroquad4exec6resume17h76329c7429a85eb0E http://192.168.131.1:5500/test-macroquad.wasm:2478989
EventHandler$GT$4draw28_$u7b$$u7b$closure$u7d$$u7d$17h2facb320c6b511deE http://192.168.131.1:5500/test-macroquad.wasm:2724557
EventHandler$GT$4draw12maybe_unwind17h2bca6f1af35cf9d4E http://192.168.131.1:5500/test-macroquad.wasm:2724226
EventHandler$GT$4draw17h435660975f57fa95E http://192.168.131.1:5500/test-macroquad.wasm:2723501
_ZN8miniquad6native4wasm5frame28_$u7b$$u7b$closure$u7d$$u7d$17h495e9c0d0166300dE http://192.168.131.1:5500/test-macroquad.wasm:3279250
_ZN8miniquad6native4wasm4with28_$u7b$$u7b$closure$u7d$$u7d$17h5f2f66bbeea2ec2cE http://192.168.131.1:5500/test-macroquad.wasm:3279010
_ZN3std6thread5local17LocalKey$LT$T$GT$8try_with17h3d96de2bdad88c07E http://192.168.131.1:5500/test-macroquad.wasm:3362809
_ZN3std6thread5local17LocalKey$LT$T$GT$4with17h3a8b1bc7fc0694c9E http://192.168.131.1:5500/test-macroquad.wasm:3362366
_ZN8miniquad6native4wasm4with17h7b09e5a15d529252E http://192.168.131.1:5500/test-macroquad.wasm:3274312
frame http://192.168.131.1:5500/test-macroquad.wasm:3283887
This can be reproduced with the following code:
#[macroquad::main("")]
async fn main() {
loop {
egui_macroquad::ui(|_| {});
macroquad::window::next_frame().await
}
}
Inserting a call to egui_macroquad::draw
also gives the same panic (as far as I can tell).
With:
[dependencies]
"macroquad" = "=0.3.15"
"egui-macroquad" = "0.9.0"
I am unable to install:
Updating crates.io index
error: failed to select a version for `miniquad`.
... required by package `egui-miniquad v0.9.0`
... which satisfies dependency `egui-miniquad = "^0.9.0"` of package `egui-macroquad v0.9.0`
... which satisfies dependency `egui-macroquad = "^0.9.0"` of package `routemaster v0.1.0 (/home/jack/git/routemaster)
`
versions that meet the requirements `=0.3.0-alpha.43` are: 0.3.0-alpha.43
all possible versions conflict with previously selected packages.
previously selected package `miniquad v0.3.0-alpha.45`
... which satisfies dependency `miniquad = "=0.3.0-alpha.45"` of package `macroquad v0.3.15`
... which satisfies dependency `macroquad = "=0.3.15"` of package `routemaster v0.1.0 (/home/jack/git/routemaster)`
failed to select a version for `miniquad` which could resolve this conflict
I think this is because egui-miniquad has a dep on miniquad alpha 0.43
, but macroquad
now depends on miniquad alpha 0.45
.
Is it possible to push a new version of egui-miniquad or maybe ease the dependency strictness?
Thanks!
i'd like to have floating windows on top of my game. how can i check that a mouse click was on top of an egui window so i can ignore it in my game?
Hi, I have a question about egui_extra.
Since this crate is very usefull, I was wondering how can I use it with a diffrent renderer (ex: bevy, macroquad etc.).
I'm facing the problem there is no implementation of egui_extra for macroquad
.
This cause this obvious error :
error[E0308]: mismatched types
--> src/table_view.rs:16:43
|
16 | let mut table = TableBuilder::new(ui)
| ----------------- ^^ expected struct `egui::ui::Ui`, found struct `egui_macroquad::egui::Ui`
| |
| arguments to this function are incorrect
|
= note: struct `egui_macroquad::egui::Ui` and struct `egui::ui::Ui` have similar names, but are actually distinct types
I believe there is a way to do it because it is very usefull. But I wasnt able to find the trick.
Hi there,
I noticed the current version of egui in the Cargo.toml file is out of date. The current version of egui is 0.22.0.
Can you please update to the latest versions to take advantage of the latest features and bug fixes?
When running the readme example, a window is opened, then immediately closes with this backtrace:
thread 'main' panicked at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.3.26/src/lib.rs:429:9: assertion failed: !QUAD_CONTEXT.is_null() stack backtrace: 0: rust_begin_unwind at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/std/src/panicking.rs:647:5 1: core::panicking::panic_fmt at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:72:14 2: core::panicking::panic at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/panicking.rs:144:5 3: macroquad::get_quad_context at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.3.26/src/lib.rs:429:9 4: macroquad::window::get_internal_gl at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.3.26/src/window.rs:51:23 5: egui_macroquad::Egui::new at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-macroquad-0.15.0/src/lib.rs:72:34 6: egui_macroquad::get_egui at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-macroquad-0.15.0/src/lib.rs:63:25 7: egui_macroquad::ui at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/egui-macroquad-0.15.0/src/lib.rs:94:5 8: viewer::amain::{{closure}} at ./crates/viewer/src/main.rs:10:9 9: macroquad::exec::resume at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/exec.rs:72:11 10: ::draw::{{closure}} at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/lib.rs:688:24 11: ::draw::maybe_unwind at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/lib.rs:679:21 12: ::draw at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/lib.rs:684:26 13: miniquad::native::linux_x11::glx_main_loop at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.0/src/native/linux_x11.rs:404:9 14: miniquad::native::linux_x11::run at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.0/src/native/linux_x11.rs:572:39 15: miniquad::start at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/miniquad-0.4.0/src/lib.rs:253:17 16: macroquad::Window::from_config at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/lib.rs:764:9 17: macroquad::Window::new at /home/skyfall/.cargo/registry/src/index.crates.io-6f17d22bba15001f/macroquad-0.4.5/src/lib.rs:753:9 18: viewer::main at ./crates/viewer/src/main.rs:3:1 19: core::ops::function::FnOnce::call_once at /rustc/7cf61ebde7b22796c69757901dd346d0fe70bd97/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Using the following dependencies:
egui = "0.21"
egui-macroquad = "0.15.0"
macroquad = "0.4.5"
error: failed to select a version for `miniquad`.
... required by package `egui-miniquad v0.8.0`
... which satisfies dependency `egui-miniquad = "^0.8.0"` of package `egui-macroquad v0.8.0`
... which satisfies dependency `egui-macroquad = "^0.8.0"` of package `rrr-render v0.0.1 (L:\git\flashflashrevolution\games\rrr\crates\render)`
versions that meet the requirements `=0.3.0-alpha.43` are: 0.3.0-alpha.43
all possible versions conflict with previously selected packages.
previously selected package `miniquad v0.3.0-alpha.42`
... which satisfies dependency `miniquad = "=0.3.0-alpha.42"` of package `macroquad v0.3.13`
... which satisfies dependency `macroquad = "^0.3.13"` of package `rrr-render v0.0.1 (L:\git\flashflashrevolution\games\rrr\crates\render)`
failed to select a version for `miniquad` which could resolve this conflict
[dependencies]
rrr = { path = "../rrr", version = "0.0.1" }
egui = "0.16.1"
egui-macroquad = "0.8.0"
macroquad = { version = "0.3.13", default-features = false }
The change is macroquad 0.3.6
to 0.3.13
.
I'm not sure if this is a egui dependency declaration problem, or a macroquad/miniquad one, or if it's me.
When trying to resize windows/panels it doesn't work diagonally and horizontally, but vertically it, for some reason, decides to not resize itself but to move on the Y axis following the cursor
I'm attempting to use kira with both egui and macroquad. Unfortunately macroquad and kira have a native dependency conflict.
The solution is to disable the default audio
feature on macroquad but I'm unable to do so because egui-macroquad
keeps them on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.