Giter Site home page Giter Site logo

erikwdev / egui-macroquad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from optozorax/egui-macroquad

0.0 0.0 0.0 9.03 MB

egui bindings for macroquad

Home Page: https://optozorax.github.io/egui-macroquad/

License: Apache License 2.0

Shell 12.47% Rust 87.53%

egui-macroquad's Introduction

egui bindings for macroquad

Latest version Documentation MIT Apache

This is the easiest way to use egui. Just two functions!

Web demo.

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:

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 egui

        next_frame().await;
    }
}

Building

Building for native and for web works just as in macroquad. You can read about it here. Or you could look at building example at egui-miniquad.

But for wasm you will need to include two more .js files, which is plugins for quads, instruction is written here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.