Egui bindings for miniquad

Related tags

GUI egui-miniquad
Overview

egui bindings for miniquad

Latest version Documentation Build Status MIT Apache

native

On Linux you first must run apt install libx11-dev libxi-dev libgl1-mesa-dev (miniquad dependencies).

cargo run --release --example demo

Compiling for the web

You can compile your app to WASM and publish it as a web page. For this you need to set up some tools. There are a few simple scripts that help you with this:

./setup_web.sh
./build_web.sh
./start_server.sh
open http://127.0.0.1:8080/
  • setup_web.sh installs the tools required to build for web
  • build_web.sh compiles your code to wasm and puts it in the docs/ folder (see below)
  • start_server.sh starts a local HTTP server so you can test before you publish
  • Open http://127.0.0.1:8080/ in a web browser to view

The finished web app is found in the docs/ folder (this is so that you can easily share it with GitHub Pages).

You can try the demo in this repository by visiting https://not-fl3.github.io/egui-miniquad/.

Comments
  • Unable to run test_window example

    Unable to run test_window example

    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.

    opened by Ace4896 6
  • add scale property permitting to modify pixels per point value

    add scale property permitting to modify pixels per point value

    Hello,

    This PR is relative to this issue : https://github.com/not-fl3/egui-miniquad/issues/39.

    I would like to permit modify pixels_per_point value (currently reset at each frame). I would be happy to receive your review on this PR (I don't know if my approach is good with your architecture or philosophy).

    Thanks for your work, buxx.

    opened by buxx 4
  • fix drawing textures (e.g. ui.image)

    fix drawing textures (e.g. ui.image)

    Hello!

    I noticed that if you try to use egui::Ui::image it draws the egui font image instead; and it seems like the TextureId is simply ignored here. I'm not super-happy with the unsafe API here (see my PR here: https://github.com/not-fl3/miniquad/pull/219).

    Let me know if there's a better way to "smuggle" the texture handle through here.

    opened by tgolsson 4
  • move drawing in separate method

    move drawing in separate method

    This might be useful in egui bindings for macroquad, based on this crate.

    Right now I am doing egui-macroquad crate, and found that current system with drawing right at end of the frame is doesn't fit into macroquad architecture. In macroquad it is more convenient to process input (keys, gui) in the beginning, and then to draw everything. For this reasons, there is draw_megaui function in other immediate-mode GUI that used in macroquad.

    opened by optozorax 4
  • Release egui-miniquad 0.12.0

    Release egui-miniquad 0.12.0

    This is currently blocked on a problem with the web demo.

    I updated gl.js to https://github.com/not-fl3/miniquad/blob/v0.3.12/js/gl.js yet I get this wen I try the web demo:

    …
    gl.js:1392 No __wbindgen_throw function in gl.js
    add_missing_functions_stabs @ gl.js:1392
    gl.js:1392 No __wbindgen_memory function in gl.js
    add_missing_functions_stabs @ gl.js:1392
    gl.js:1426 WASM failed to load, probably incompatible gl.js version
    (anonymous) @ gl.js:1426
    gl.js:1427 TypeError: WebAssembly.instantiate(): Import #5 module="__wbindgen_placeholder__" error: module is not an object or function
        at gl.js:1409:36
    

    Any ideas @not-fl3 ?

    opened by emilk 3
  •  Usage of egui Context.set_pixels_per_point don't work

    Usage of egui Context.set_pixels_per_point don't work

    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 ?

    opened by buxx 3
  • Fix blending

    Fix blending

    This PR fixes blending, making text look much clearer. I replaced the fragment shader code with the stuff from egui-glow, and I changed the gamma value in the texture update code to the one used in egui-glow.

    opened by UE2020 2
  • Bump dependency on miniquad to latest alpha

    Bump dependency on miniquad to latest alpha

    I'm currently unable to install egui-macroquad with the latest macroquad because of a difference in their miniquad-alpha dependencies (see https://github.com/optozorax/egui-macroquad/issues/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!

    opened by jackfranklin 2
  • Add readme fix build

    Add readme fix build

    • fixes build from using the webbrowser crate, because this is only used in macos according to the cargo.toml
    • adds readme with some very basic instructions

    Also, I didnt include it in this PR, because i dont think Its up to me to decide, but could you add a license to this project please?

    opened by nikita-skobov 2
  • Fix scroll speed

    Fix scroll speed

    This fixes very slow scroll speed. The old comment said the scroll speed was fine for web but too slow for mac. I am on windows, and it is also too slow for me. It now checks target_arch and multiplies by 8 if not on wasm32.

    opened by kaikalii 1
  • Example rendering miniquad scene into egui image

    Example rendering miniquad scene into egui image

    Here is an example that may be useful for those who would like to render scenes into an egui image using miniquad.

    See https://github.com/emilk/egui/issues/729#issuecomment-923221987 for reference

    opened by bpostlethwaite 1
  • Cannot paste in TextEdit

    Cannot paste in TextEdit

    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.

    opened by Marekkon5 0
  • build failed for windows 32 programs (i686)

    build failed for windows 32 programs (i686)

    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
    
    opened by bigdogs 0
  • Double-click issue

    Double-click issue

    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?

    opened by EvoTeamDevelop 3
  • Key modifier state after a modifier is pressed or released

    Key modifier state after a modifier is pressed or released

    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).

    Test program (using egui-miniquad v0.12.0 and miniquad v0.3.13)
    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)));
    }
    
    
    opened by quaternic 2
  • how to stop drawing of  miniquad mouse pointer when mouse point to egui GUI area?

    how to stop drawing of miniquad mouse pointer when mouse point to egui GUI area?

    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?

    opened by skydig 1
Releases(0.12.0)
  • 0.12.0(Aug 21, 2022)

    • Update egui to 0.19.0
    • You can now scale the GUI with egui_ctx.set_pixels_per_point(…).
    • Add miniquad context as a parameter in the lambda in EguiMq::run
    Source code(tar.gz)
    Source code(zip)
Owner
Fedor Logachev
Fedor Logachev
A presentation about egui, implemented in egui

egui presentation A presentation about egui, implemented in egui. You can view the presentation at https://emilk.github.io/egui_presentation/. TODO Li

Emil Ernerfeldt 9 Aug 24, 2023
Egui bindings for macroquad

egui bindings for macroquad This is the easiest way to use egui. Just two functions! Web demo. Usage You need to call ui when you need to get informat

ilya sheprut 54 Dec 28, 2022
This project attempts to allow the creation of reusable egui-themes

egui stylist Note this project is considered to be experimental and -- while used in personal projects -- may have API breaking changes without warnin

Jacobsky 22 Dec 1, 2022
A simple GUI version of the pH calibration tool written in egui, based on the eframe template.

caliphui A simple GUI version of the pH calibration tool written in egui, based on the eframe template. Usage Native binaries are provided under relea

Peter Dunne 0 Dec 29, 2021
FLTK frontend for Egui WGPU backend.

Egui FLTK Frontend FLTK Frontend for Egui WGPU Backend On linux Debian/Ubuntu, make sure to install the latest main requirements: sudo apt-get update

Adia Robbie 5 Oct 25, 2022
egui: an easy-to-use immediate mode GUI in pure Rust

?? egui: an easy-to-use GUI in pure Rust egui is a simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, native

Emil Ernerfeldt 12.6k Jan 3, 2023
D3D11 backend for egui library. Presumably for mods/cheats development

D3D11 backend for egui library. Presumably for mods/cheats development. Currently few features from egui are missing. WIP.

sy1ntexx 24 Jan 4, 2023
Render egui with skia!

Skia backend for egui This is a drawing backend for egui that uses skia-safe. Usage Have a look at the metal or cpu examples to get started. Run the e

null 14 Dec 19, 2022
a day-planner/calendar app based on egui

Malakal Malakal is a day planner application. I crafted it because I was not able to find a comfortable calendar application for Linux. I myself have

null 5 Dec 21, 2022
Example showing how to use tokio and egui together.

Example using tokio with egui This example uses reqwest to send an HTTP request to httpbin. The parsed response contains an increment value (as provid

Jay Oster 10 Dec 25, 2022
A render-backend independant egui backend for sdl2

A Sdl2 + Egui Backend An egui backend for sdl2 unbound to any renderer-backend. You can include it like so: [dependencies] egui_sdl2_platform = "0.1.0

null 4 Dec 16, 2022
egui backend for D3D9.

egui-d3d9 egui backend for D3D9. Primarily intended for source games like CS:GO and GMod. It's not perfect by far, but it'll do. This is a rewrite of

unknowntrojan 6 Dec 25, 2022
A tool for creating egui Visuals (themes).

egui-visuals-utility A tool for creating egui Visuals (themes). The code is rather messy and might crash but it seems to work. To load the theme use s

null 7 Jan 13, 2023
egui port to Car Thing (and maybe an alternative Car Thing UI?)

tt This project contains a port of egui to the Spotify Car Thing although in the future I also plan for it to contain a custom Car Thing UI. Technical

Andy Bao 7 Dec 30, 2022
Create dynamic grid-based layouts for egui

egui_grid Create dynamic grid layouts for egui. Grids are flexible, easy to create, with behavior similar to egui_extra's strip creation. They're comp

null 6 Apr 18, 2023
Provides event handling for egui in SDL2 window applications.

egui-sdl2-event Provides event handling for egui when SDL2 is used as the windowing system. This crate does not perform any rendering, but it can be c

Valtteri Vallius 8 Feb 15, 2023
An interactive JSON tree visualiser for egui, with search and highlight functionality.

egui_json_tree An interactive JSON tree visualiser for egui, with search and highlight functionality. Usage use egui::{Color32}; use egui_json_tree::{

null 13 Sep 1, 2023
egui integration for ash (Vulkan).

egui-ash egui integration for ash (Vulkan). This crate natively supports the multi-viewports feature added since version 0.24 of egui. You can use gpu

Orito Itsuki 6 Dec 24, 2023
A Vulkan renderer for egui using Ash.

egui-ash-renderer A Vulkan renderer for egui using Ash. This is meant to add support for egui in your existing Vulkan/ash applications. Not a full efr

Adrien Bennadji 4 Apr 10, 2024