Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/optozorax/egui-macroquad
egui bindings for macroquad
https://github.com/optozorax/egui-macroquad
egui macroquad rust wasm webassembly
Last synced: about 2 months ago
JSON representation
egui bindings for macroquad
- Host: GitHub
- URL: https://github.com/optozorax/egui-macroquad
- Owner: optozorax
- License: apache-2.0
- Created: 2021-03-11T15:56:55.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-28T06:44:31.000Z (6 months ago)
- Last Synced: 2024-11-13T16:50:34.864Z (about 2 months ago)
- Topics: egui, macroquad, rust, wasm, webassembly
- Language: Rust
- Homepage: https://optozorax.github.io/egui-macroquad/
- Size: 8.57 MB
- Stars: 92
- Watchers: 2
- Forks: 76
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-quads - egui-macroquad - [egui](https://github.com/emilk/egui) in macroquad. (Libraries / Libraries: Integrations)
README
# [egui](https://github.com/emilk/egui) bindings for [macroquad](https://github.com/not-fl3/macroquad)
[![Latest version](https://img.shields.io/crates/v/egui-macroquad.svg)](https://crates.io/crates/egui-macroquad)
[![Documentation](https://docs.rs/egui-macroquad/badge.svg)](https://docs.rs/egui-macroquad)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)This is the easiest way to use egui. Just two functions!
[Web demo.](https://optozorax.github.io/egui-macroquad/)
# Usage
You need to call `ui` when you need to get information from ui. Then, only after that function you must call `draw` function when you need to draw egui contents. All this functions should be called each frame and once per frame.
Here is the small example on how to use this library:
```rust
use macroquad::prelude::*;#[macroquad::main("egui with macroquad")]
async fn main() {
loop {
clear_background(WHITE);// Process keys, mouse etc.
egui_macroquad::ui(|egui_ctx| {
egui::Window::new("egui ❤ macroquad")
.show(egui_ctx, |ui| {
ui.label("Test");
});
});// Draw things before egui
egui_macroquad::draw();
// Draw things after eguinext_frame().await;
}
}
```# Building
Building for native and for web works just as in `macroquad`. You can read about it [here](https://github.com/not-fl3/miniquad/#building-examples). Or you could look at building example at [egui-miniquad](https://github.com/not-fl3/egui-miniquad).
But for wasm you will need to include two more `.js` files, which is plugins for quads, instruction is written [here](https://github.com/optozorax/quad-url).