Giter Club home page Giter Club logo

imgui-qtquick-wasm-port's Introduction

Integration of Dear ImGui 1.66b with Qt Quick

There are multiple ways to do this. Here we chose to expose a QQuickItem backed by a QSGRenderNode (that issues the draw calls directly, no intermediate render target; both threaded and basic render loops should work).

Alternatives would be to do it overlay-style connected to QQuickWindow::afterRendering() or to construct scenegraph nodes (a geometry node for each ImDrawCmd, clip nodes, etc.), each coming with its own pros and cons.

By having a true Quick item, the ImGui "desktop"'s position, size, stacking, opacity, etc. is fully under the application's control and can be controlled via the usual QML means, while the frame generation can be hooked onto a convenient signal. Note that this will not allow arbitrary transformations on the item, apart from translation (scale should be fixed at some point though. the rest just won't work.)

import QtQuick 2.0
import ImGui 1.0

Rectangle {
    id: root

    ...

    ImGui {
        objectName: "imgui"
        anchors.fill: parent
        focus: true
    }
}

int main(int argc, char *argv[])
{
    ...

    QQuickView viewer;
    viewer.setSource(QUrl("qrc:/main.qml"));

    ImGuiItem *imguiItem = viewer.rootObject()->findChild<ImGuiItem *>("imgui");
    QObject::connect(imguiItem, &ImGuiItem::frame, imguiItem, [] {
        ImGui::Text("Hello, world!");
    });

    ...

imgui-qtquick-wasm-port's People

Contributors

alpqr avatar

Watchers

 avatar  avatar

Forkers

derofim

imgui-qtquick-wasm-port's Issues

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.