not-fl3 / egui-miniquad Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
cargo b --release --example demo --target i686-pc-windows-msvc
error[E0308]: mismatched types
--> C:\Users\Admin\.cargo\registry\src\github.com-1ecc6299db9ec823\miniquad-0.3.13\src\native\windows.rs:887:47
|
887 | SetWindowLongPtrA(wnd, GWLP_USERDATA, &mut p as *mut _ as isize);
| ----------------- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `isize`
| |
| arguments to this function are incorrect
Is there any kind of custom UI scaling support? So it can be changed in runtime globally for all ui elements and be not a system specific.
egui supports it via egui::Context::set_pixels_per_point. And it works in their demo app. Each new frame this value is copied from the context into the raw input here. But egui-miniquad sets some system specific value here into egui::RawInput, the same value is used to draw ui here and to get mouse cursor position here.
How about to support custom UI scaling via egui::Context::set_pixels_per_point?
Hi, I've been looking into egui and wanted to try out miniquad for rendering. I was trying to update this to work with the latest miniquad and egui versions, but the app crashes immediately with:
error: process didn't exit successfully: `target\debug\examples\test_window.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
I'm seeing this error with the versions used by the current master branch as well, so I'm not sure where the error is coming from.
I'm on Windows 10 2004 with Rust 1.47.0. If it helps, I've tried out the miniquad examples from the main repo, and they work fine.
There are two issues with how egui-miniquad
handles mouse cursor currently.
end_frrame
: Line 179 in e388643
egui-miniquad
mouse cursor is always visible.mq_ctx.show_mouse()
every frame, which makes the cursor change very laggy (at least on Windows). My experiments show if I call show_mouse()
only when mouse cursor state needs to change, the cursor change is instant. I guess the OS event queue gets stuck by setting the mouse cursor so often.Hello, pasting into EditText causes a panic because of double mut borrow.
PanicInfo { payload: Any { .. }, message: Some(already borrowed: BorrowMutError), location: Location { file: "/Users/optozorax/.cargo/registry/src/github.com-1ecc6299db9ec823/miniquad-0.3.13/src/native/wasm.rs", line: 95, col: 35 }, can_unwind: true }
It is reproducible in the official example: https://optozorax.github.io/egui-macroquad/
(pasting anything in the demo TextEdit causes a panic).
Thank you.
Hello,
I'm working about to find a way to integrate the egui text agent feature which permit to smartphone virtual keyboard to show up on egui text field. I started to study egui side mechanism.
Text agent is "installed" by https://github.com/emilk/egui/blob/713917e4819d9c26068aec286ee675f7e3bff907/egui_web/src/text_agent.rs#L24 which is called from egui::start : https://github.com/emilk/egui/blob/master/egui_web/src/backend.rs#L365
Can you give me some information about egui miniquad integration to permit me to add this text agent ?
There is a bug in Windows which is fixed by the new miniquad
version, and people want to use fixed version of this crate. So, please publish new version of this crate based on the latest master
.
Hello everyone. I compiled an example of egui-miniquad (https://github.com/frgomes/egui- miniquad-demo) on Macos 10.15, and I encountered two problems.
The first is that the example can be compiled successfully, but the runtime report is wrong:
Assertion failed: (_sapp_macos_glpixelformat_obj != ((void *)0)), function -[_sapp_macos_app_delegate applicationDidFinishLaunching:], file external/sokol/sokol_app.h, line 1369
The second question is: when I use ./build.sh web --example demo to compile WASM, it is prompted to have the following errors:
Note: I used PKG to install Rust. Rustc and Cargo can be used normally, but Rustup seems to have problems. When I use Rustup Default Stable commands, I will report an error: Zsh: Illegal Hardware Instruction。
How can I solve these problems? Thanks.
I'm trying to use the NEAREST filter for enlarged images, which I show in an ImageButton. The code I use to load the texture is the following:
ui.ctx().load_texture("tex", image, egui::TextureOptions::NEAREST)
I would expect this to give the "pixelized" effect, but it looks like it's using the LINEAR filter instead (blurry).
Could it be this line? It seems that Linear
is always used:
filter: miniquad::FilterMode::Linear,
I checked the loaded texture options, and at least according to TextureManager, it seems to be set correctly:
let meta = ui.ctx().tex_manager().read().meta(tex.id()).unwrap().options;
dbg!(meta);
// output:
// meta = TextureOptions {
// magnification: Nearest,
// minification: Nearest,
// }
I'm not sure also if this is the correct place to report this, or if I should open the issue in egui
. I use egui-miniquad
as backend (with egui-macroquad
on top of it, but that's only a few lines of code).
see the attached picture I captured on windows OS
blur.zip
is there way to know event is consumed by egui just like what has done for egui-glium?
very thanks
egui-glium code:
let event_response = egui_glium.on_event(&event);
// if event_response's consumed is true, means event is consumed by egui,
if event_response.repaint {
display.gl_window().window().request_redraw();
}
The methods have different signatures on MacOS:
#[cfg(not(target_os = "macos"))]
fn set_clipboard(&mut self, text: String) {
mq::window::clipboard_set(&text);
}
#[cfg(not(target_os = "macos"))]
fn get_clipboard(&mut self) -> Option<String> {
mq::window::clipboard_get()
}
#[cfg(target_os = "macos")]
fn set_clipboard(&mut self, _mq_ctx: &mut mq::Context, text: String) {...}
#[cfg(target_os = "macos")]
fn get_clipboard(&mut self, _mq_ctx: &mut mq::Context) -> Option<String> {...}
but their calls only use the non-macos signature.
As the _mq_ctx
argument is no longer used, can it be removed please?
For some reason, when running app on macOs or Android it is required to use double-click when using egui buttons, slider, combo-boxes or etc. But this is not happening all the time, but only time to time, so it is really strange why it can be happening.
Does anybody else is also facing this issue?
The modifier key state changes are only reaching egui
on the next key event. For example, if you press and hold Ctrl
and don't press any other key, egui
will not know about it. If you then release it, egui
will now think it is being held down, until some future key event.
As I understand it, miniquad
is passing through (from X11
) key up/down events whose modifier state does not include the effect of that event itself. Next, egui-miniquad
stores that pre-event modifier state and discards the key event since egui
doesn't care about those. It then sends that incorrect state to egui
for new frames and with events where miniquad
doesn't include the modifier state (e.g. mouse events).
use {egui_miniquad as egui_mq, miniquad as mq};
struct Stage {
egui_mq: egui_mq::EguiMq,
}
impl Stage {
pub fn new(ctx: &mut mq::Context) -> Stage {
Stage {
egui_mq: egui_mq::EguiMq::new(ctx),
}
}
}
impl mq::EventHandler for Stage {
fn update(&mut self, _ctx: &mut mq::Context) {}
fn draw(&mut self, ctx: &mut mq::Context) {
self.egui_mq.run(ctx, |mq_ctx, egui_ctx| {
egui::CentralPanel::default().show(&egui_ctx, |ui| {
ui.label(format!("{:#?}",ui.input().modifiers));
});
});
self.egui_mq.draw(ctx);
ctx.commit_frame();
}
fn mouse_motion_event(&mut self, _: &mut mq::Context, x: f32, y: f32) {
self.egui_mq.mouse_motion_event(x, y);
}
fn mouse_wheel_event(&mut self, _: &mut mq::Context, dx: f32, dy: f32) {
self.egui_mq.mouse_wheel_event(dx, dy);
}
fn mouse_button_down_event(
&mut self,
ctx: &mut mq::Context,
mb: mq::MouseButton,
x: f32,
y: f32,
) {
self.egui_mq.mouse_button_down_event(ctx, mb, x, y);
}
fn mouse_button_up_event(
&mut self,
ctx: &mut mq::Context,
mb: mq::MouseButton,
x: f32,
y: f32,
) {
self.egui_mq.mouse_button_up_event(ctx, mb, x, y);
}
fn char_event(
&mut self,
_ctx: &mut mq::Context,
character: char,
_keymods: mq::KeyMods,
_repeat: bool,
) {
self.egui_mq.char_event(character);
}
fn key_down_event(
&mut self,
ctx: &mut mq::Context,
keycode: mq::KeyCode,
keymods: mq::KeyMods,
_repeat: bool,
) {
if keycode == mq::KeyCode::Q {
std::process::exit(0);
}
println!("---KEY DOWN---");
dbg!(keycode);
dbg!(keymods);
println!("calling egui_mq.key_down_event");
self.egui_mq.key_down_event(ctx, keycode, keymods);
println!("---END---");
}
fn key_up_event(&mut self, _ctx: &mut mq::Context, keycode: mq::KeyCode, keymods: mq::KeyMods) {
println!("---KEY UP---");
dbg!(keycode);
dbg!(keymods);
println!("calling egui_mq.key_up_event");
self.egui_mq.key_up_event(keycode, keymods);
println!("---END---");
}
}
fn main() {
mq::start(Default::default(), |mut ctx| Box::new(Stage::new(&mut ctx)));
}
The code on lib.rs (lines 198-205) contains a struct pattern error (shown below) because it doesn't account for the field accesskit_update
that may be present on the egui::PlatformOutput
type.
error[E0027]: pattern does not mention field `accesskit_update`
--> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.14.0/src/lib.rs:198:13
|
198 | let egui::PlatformOutput {
| _____________^
199 | | cursor_icon,
200 | | open_url,
201 | | copied_text,
... |
204 | | mutable_text_under_cursor: _, // no IME
205 | | } = platform_output;
| |_________^ missing field `accesskit_update`
This is the signature for the struct PlatformOutput on egui:
#[derive(Default, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct PlatformOutput {
[...]
#[cfg(feature = "accesskit")]
pub accesskit_update: Option<accesskit::TreeUpdate>,
}
Possible fix: as suggested by the Rust compiler,
help: if you don't care about this missing field, you can explicitly ignore it
|
204 | mutable_text_under_cursor: _, .. } = platform_output;
| ~~~~~~
when press ctrl + A, following is reported(don't understant \u{1a} means) on windows 10 OS
character='\u{1a}'
_keymods _repeat=KeyMods { shift: false, ctrl: true, alt: false, logo: false } false
when press alt+... nothing reported
but alt key is ok on linux ubuntu OS.
Hello,
I'm trying to use Context.set_pixels_per_point don't work function, but it has no effect. Example :by modifying demo example :
[...]
// Run the UI code:
self.egui_mq.run(ctx, |egui_ctx| {
egui_ctx.set_pixels_per_point(2.0);
[...]
Do you know why it has no effect and how to fix it ?
use egui::*;
use {egui_miniquad as egui_mq, miniquad as mq};
struct Stage {
egui_mq: egui_mq::EguiMq,
}
impl Stage {
fn new(ctx: &mut mq::Context) -> Self {
Self {
egui_mq: egui_mq::EguiMq::new(ctx),
}
}
}
impl mq::EventHandler for Stage {
fn update(&mut self, _ctx: &mut mq::Context) {}
fn draw(&mut self, mq_ctx: &mut mq::Context) {
mq_ctx.clear(Some((0., 0., 0., 1.)), None, None);
self.egui_mq.run(mq_ctx, |egui_ctx| {
const SAMPLE_GRAPH_SIZE: usize = 331;
egui::Window::new("tapes").show(egui_ctx, |ui| {
egui_ctx.request_repaint();
for _ in 0..8 {
ui.group(|ui| {
let desired_size = ui.available_width() * vec2(1.0, 0.02);
let (_id, rect) = ui.allocate_space(desired_size);
let to_screen = emath::RectTransform::from_to(
Rect::from_x_y_ranges(0.0..=1.0, -1.0..=1.0),
rect,
);
let mut shapes = vec![];
let points: Vec<Pos2> = (0..SAMPLE_GRAPH_SIZE)
.enumerate()
.map(|(index, _)| {
to_screen * pos2(index as f32 / SAMPLE_GRAPH_SIZE as f32, 0.)
})
.collect();
shapes.push(epaint::Shape::line(
points,
Stroke::new(1.0, Color32::WHITE),
));
ui.painter().extend(shapes);
});
}
});
});
self.egui_mq.draw(mq_ctx);
mq_ctx.commit_frame();
}
}
fn main() {
mq::start(Default::default(), |mut ctx| {
mq::UserData::owning(Stage::new(&mut ctx), ctx)
});
}
The code above crashes on my 2015 MacBook Pro when SAMPLE_GRAPH_SIZE is 331. It works if if it is less than 331 for this example. I'm using miniquad 0.3.0-alpha.46
, egui-miniquad 0.11.0
and egui 0.18.0
Here is the stack trace, hope it helps.
_platform_memmove$VARIANT$Haswell (@_platform_memmove$VARIANT$Haswell:75)
glrIntelRenderVertexArray (@glrIntelRenderVertexArray:414)
glDrawElementsInstanced_ACC_GL3Exec (@glDrawElementsInstanced_ACC_GL3Exec:96)
miniquad::graphics::Context::draw (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/miniquad-0.3.0-alpha.46/src/graphics.rs:1113)
egui_miniquad::painter::Painter::paint_job (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/painter.rs:277)
egui_miniquad::painter::Painter::paint (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/painter.rs:188)
egui_miniquad::painter::Painter::paint_and_update_textures (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/painter.rs:161)
egui_miniquad::EguiMq::draw (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-miniquad-0.11.0/src/lib.rs:195)
<modul::Stage as miniquad::event::EventHandler>::draw (/Users/zehreken/Development/modul/src/main.rs:51)
miniquad::frame (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/miniquad-0.3.0-alpha.46/src/lib.rs:309)
_sapp_call_frame (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/sapp-darwin-0.1.8/external/sokol/sokol_app.h:987)
_sapp_frame (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/sapp-darwin-0.1.8/external/sokol/sokol_app.h:1083)
_sapp_macos_frame (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/sapp-darwin-0.1.8/external/sokol/sokol_app.h:1311)
-[_sapp_macos_view drawRect:] (/Users/zehreken/.cargo/registry/src/github.com-1ecc6299db9ec823/sapp-darwin-0.1.8/external/sokol/sokol_app.h:1548)
-[_NSOpenGLViewBackingLayer display] (@-[_NSOpenGLViewBackingLayer display]:196)
CA::Layer::display_if_needed(CA::Transaction*) (@CA::Layer::display_if_needed(CA::Transaction*):193)
CA::Context::commit_transaction(CA::Transaction*, double, double*) (@CA::Context::commit_transaction(CA::Transaction*, double, double*):128)
CA::Transaction::commit() (@CA::Transaction::commit():199)
__62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke (@__62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke:70)
___NSRunLoopObserverCreateWithHandler_block_invoke (@___NSRunLoopObserverCreateWithHandler_block_invoke:18)
The difference between the current version 0.3.12 API and the latest API version is too large. If I want to use EGUI, I must downgrade the version of MiniQuad
I found two kinds of mouse pointer overlaped and blink one after another when the mouse point to for example, textarea, conner of one egui window on ubuntu linux.
how to remove miniquad pointer when operate in area of egui?
I wrote https://github.com/eras/ClickMuteJack/ using this and noticed that it crashes if I start it with an empty DISPLAY
:
% DISPLAY= target/debug/click_mute
Loaded config from click_mute.ini
XOpenDisplay() failed!
zsh: segmentation fault DISPLAY= target/debug/click_mute
Doesn't seem like there's a way to handle this problem in user code.
Similar crash happens with non-empty DISPLAY
but no permission for the server, which is how I noticed this issue in the first place. The gui code is here: https://github.com/eras/ClickMuteJack/blob/master/src/gui.rs
This is a tracking issue for some things still lacking
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7c573c2 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff7c573c2 in __memmove_sse2_unaligned_erms () from /usr/lib/libc.so.6
#1 0x00007ffff66bf629 in ?? () from /usr/lib/libnvidia-glcore.so.450.66
#2 0x00007ffff66cb4cc in ?? () from /usr/lib/libnvidia-glcore.so.450.66
#3 0x00007ffff6246d35 in ?? () from /usr/lib/libnvidia-glcore.so.450.66
#4 0x000055555558c910 in miniquad::graphics::Context::draw (self=0x5555557ae6e0, base_element=0, num_elements=888,
num_instances=1)
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/miniquad-0.3.0-alpha.11/src/graphics.rs:1038
#5 0x00005555555842b6 in emigui_miniquad::painter::Painter::paint_job (self=0x555555bdf510, ctx=0x5555557ae6e0)
at src/painter.rs:180
#6 0x00005555555836f1 in emigui_miniquad::painter::Painter::paint (self=0x555555bdf510, ctx=0x5555557ae6e0, jobs=...,
texture=0x555555c01908) at src/painter.rs:107
#7 0x000055555557f0a6 in <test_window::Stage as miniquad::event::EventHandler>::draw (self=0x555555bdf4a0,
ctx=0x5555557ae6e0) at examples/test_window.rs:68
#8 0x000055555559f1ff in miniquad::frame (user_data=0x5555557ae6c0)
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/miniquad-0.3.0-alpha.11/src/lib.rs:185
#9 0x00005555555a80df in sapp_linux::_sapp_call_frame ()
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/sapp-linux-0.1.8/src/lib.rs:2602
#10 0x00005555555a8119 in sapp_linux::_sapp_frame ()
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/sapp-linux-0.1.8/src/lib.rs:2614
#11 0x00005555555a88e8 in sapp_linux::sapp_run (desc=0x7fffffffcdd0)
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/sapp-linux-0.1.8/src/lib.rs:2758
#12 0x000055555557f6ed in miniquad::start (conf=..., f=...)
at /home/koalefant/.cargo/registry/src/github.com-f1e60147b9cdaa30/miniquad-0.3.0-alpha.11/src/lib.rs:333
#13 0x000055555557f245 in test_window::main () at examples/test_window.rs:73
Arch linux, x64_64. Not waiting on this, was just messing around.
I renamed Emigui
to egui
last year. Sorry for that :)
It would be nice to get the new name in though so we can publish this crate as egui-miniquad
.
Thankfully, it is easy to rename a repo in GitHub (it even keeps redirecting): https://docs.github.com/en/github/administering-a-repository/renaming-a-repository
Multi touch does not work and touch input is finicky making it difficult to select Items. This only occurs in miniquad. On the official egui web demo the touch features do not have the issues listed here.
Steps to reproduce:
Result: It is very hard to select items in the right sidebar. no multi touch is detected.
Expected Result: It is easy to select items and in the multi touch window I am able to move the arrows by using two fingers and multi touch successfully displays multiple touches like 4 fingers on the screen.
I'm currently unable to install egui-macroquad with the latest macroquad because of a difference in their miniquad-alpha dependencies (see optozorax/egui-macroquad#16)
egui-miniquad depends on miniquad-alpha 43, whereas macroquad depends on miniquad-alpha 45.
I'm happy to submit a PR to update the dependency in this repo; if so would you be happy to merge and release a new version? Thanks!
With egui 0.11.0
included.
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.