Skip to content

xpenatan/gdx-imgui

Repository files navigation

gdx-imgui

Build Build Sonatype Nexus (Snapshots) Static Badge

gdx-imgui is a java binding for C++ dear-imgui.
It uses webidl file to generate java methods with the help of jParser.
It's meant to be small and 1-1 to C++. ImGui::Begin() is ImGui.Begin() and so on.

Supported extensions:

imgui-node-editor
ImGuiColorTextEdit
ImLayout

Examples

ImGui current state:

Emscripten Windows Linux Mac Android iOS
⚠️
  • ✅: Have a working build.
  • ⚠️: Have a working build, but it's not ready yet.
  • ❌: Build not ready.

Note:

* Only snapshot builds are currently available. 
* It's best to try the examples first to see how it works before adding to your project.
* There are 2 ImGui builds. The first contains ImGui only. The second (Ext) contains ImGui with extensions. 

How to run examples

There are two ways to run examples.

  • Build the source and run: ./gradlew :examples:basic:desktop:basic-run-desktop
  • Change LibExt.exampleUseRepoLibs to true in Dependencies.kt and that will make all examples use snapshot from repository

Setup

gdxVersion = "1.12.1"
gdxImguiVersion = "-SNAPSHOT"
// Add repository to Root gradle
repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}

Core module

dependencies {
    implementation("com.github.xpenatan.gdx-imgui:gdx-impl:$project.gdxImguiVersion")
    implementation("com.github.xpenatan.gdx-imgui:imgui-core:$project.gdxImguiVersion")

    // Or the extension build
    implementation "com.github.xpenatan.gdx-imgui:imgui-ext-core:$project.gdxImguiVersion"
}

Desktop module

dependencies {
    implementation("com.github.xpenatan.gdx-imgui:imgui-desktop:$project.gdxImguiVersion")

    // Or the extension build
    implementation "com.github.xpenatan.gdx-imgui:imgui-ext-desktop:$project.gdxImguiVersion"
}

TeaVM module

dependencies {
    implementation("com.github.xpenatan.gdx-imgui:imgui-teavm:$project.gdxImguiVersion")

    // Or the extension build
    implementation "com.github.xpenatan.gdx-imgui:imgui-ext-teavm:$project.gdxImguiVersion"
}

Build source

  • Requirements: Java 11, mingw64 and emscripten
  • Windows only for now.
##### ImGui
./gradlew :imgui:imgui-build:download_source
./gradlew :imgui:imgui-build:build_project
##### ImGui with extensions. Need to build ImGui first
./gradlew :extensions:imlayout:imlayout-build:build_project
./gradlew :extensions:ImGuiColorTextEdit:textedit-build:download_source
./gradlew :extensions:ImGuiColorTextEdit:textedit-build:build_project
./gradlew :extensions:imgui-node-editor:nodeeditor-build:download_source
./gradlew :extensions:imgui-node-editor:nodeeditor-build:build_project
./gradlew :imgui:imgui-ext-build:build_project