All Projects → ice1000 → Jimgui

ice1000 / Jimgui

Licence: apache-2.0
💖 Pure Java binding for dear-imgui

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Jimgui

Tess Opt
Demonstration of how we can use tessellation shaders to make faster fragment shaders.
Stars: ✭ 13 (-88.5%)
Mutual labels:  imgui
Asap app imgui
Starter project for portable app with optional GUI (GLFW/ImGui) and a rich builtin debug UI. Includes docked windows, log viewer, settings editor, configuration load/save, etc...
Stars: ✭ 70 (-38.05%)
Mutual labels:  imgui
Yakc
Yet another KC emulator
Stars: ✭ 102 (-9.73%)
Mutual labels:  imgui
Imgui
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Stars: ✭ 33,574 (+29611.5%)
Mutual labels:  imgui
Imterm
c++17 header only library implementing a terminal for imgui applications
Stars: ✭ 36 (-68.14%)
Mutual labels:  imgui
Swiftgui
SwiftGUI is an API inspired by SwiftUI DSL, using Dear ImGui as renderer and running on macOS 10.13+ and iOS 11+
Stars: ✭ 74 (-34.51%)
Mutual labels:  imgui
Spartanengine
Game engine with an emphasis on architectual quality and performance
Stars: ✭ 869 (+669.03%)
Mutual labels:  imgui
Luajit Imgui
LuaJIT ffi binding for imgui, backends and extension widgets
Stars: ✭ 107 (-5.31%)
Mutual labels:  imgui
Qtdirect3d
QDirect3DWidget implementation similar to the built-in QOpenGLWidget
Stars: ✭ 60 (-46.9%)
Mutual labels:  imgui
Imgui Ext
Rust library for building imgui GUIs using a derive macro
Stars: ✭ 100 (-11.5%)
Mutual labels:  imgui
Wtk
📺 A cross-platform immediate mode user-interface library. Public domain.
Stars: ✭ 30 (-73.45%)
Mutual labels:  imgui
Game Cheating Tutorial
热门网络游戏辅助开发教程
Stars: ✭ 961 (+750.44%)
Mutual labels:  imgui
Fury3d
A simple but modern graphic engine
Stars: ✭ 84 (-25.66%)
Mutual labels:  imgui
Blocxxi
Implementation of Kademlia based DHT and a blockchain in C++
Stars: ✭ 21 (-81.42%)
Mutual labels:  imgui
Nodable
a node-able bidirectionnal expression editor.
Stars: ✭ 103 (-8.85%)
Mutual labels:  imgui
Urhox
Urho3D extension library
Stars: ✭ 13 (-88.5%)
Mutual labels:  imgui
Dainsleif
⚡️ A simple model cheat for CSGO a.k.a. Counter-Strike: Global Offensive.
Stars: ✭ 74 (-34.51%)
Mutual labels:  imgui
Osiris
Free open-source game cheat for Counter-Strike: Global Offensive, written in modern C++. GUI powered by Dear ImGui.
Stars: ✭ 1,851 (+1538.05%)
Mutual labels:  imgui
Horus ui
HorusUI Immediate Mode Graphical User Interface
Stars: ✭ 106 (-6.19%)
Mutual labels:  imgui
Imgui Rs
Rust bindings for Dear ImGui
Stars: ✭ 1,258 (+1013.27%)
Mutual labels:  imgui

jimgui

Join the chat at https://gitter.im/imgui-java/community Version Bintray

Linux Build Windows Build
CCI AV

Cross-platform efficient pure Java binding for dear-imgui, Kotlin is used as code generation tool.

This binding is rather bare, that reflects imgui's API directly. I think it's good enough, but you may expect some other styles. There is a declarative wrapper of jimgui, namely flui available.

Features

Can be considered as both advantages and disadvantages.

Java

It is Java-only with an optional Kotlin DSL wrapper.

Pure

It hides everything about rendering behind-the-scene, so you don't need to worry about GLFW, OpenGL or DirectX stuffs (speaking of lwjgl or jogl integration -- see #18, it's hard).

Also, it doesn't separate jars for different platforms. One jar works on all platforms.

Usability

It is well-known that dear imgui doesn't have image loading out-of-the-box, but this library have, and it even has a wrapper for aiekick/ImGuiFileDialog and Flix01/imguidatechooser and some other minor widgets.

Efficiency

This is twofolded.

  • JNI efficiency. It exploits Critical Native and it avoids accessing Java from C++. Only arrays and primitive types are passed from Java to C++, and only primitive types are returned.
  • Optimization for strings. That jimgui by default uses an inefficient way to convert java.lang.String into byte arrays that C++ is happy with. You can customize the string-to-bytes function yourself by using org.ice1000.jimgui.util.JImGuiUtil.setStringToBytes the default caching JImGuiUtil.cacheStringToBytes(), or use the more efficient alternative to java.lang.String -- org.ice1000.jimgui.JImStr, which is supposed to be created as global constants.

IDE-friendliness

It exploits JetBrains annotations, particularly with MagicConstant, NotNull, Nullable and Contract.

MagicConstant annotation enables IntelliJ IDEA to provide completion for int flags arguments with only the flags needed:

image

This project was created for a code editor and a game engine, both dead.

For macOS users, make sure you add -XstartOnFirstThread JVM argument when running applications built with jimgui.

Demo

Contents

Bindings to official features

  • [X] ImGui namespace getter/setter/function/javadoc generation
  • [X] ImGuiFontAtlas/ImGuiStyle/ImGuiFont/ImGuiIO/ImGuiDrawList properties getter/setter/function/javadoc generation
  • [X] ImGui*Flags constant/javadoc generation
  • [X] ImStyleVar keys using generic parameter as type constraint (type safe!)

Extra convenience provided

  • [X] Functions to access and modify platform window size/pos
  • [X] Use MagicConstant annotation to specify where the constant parameters are from (IntelliJ IDEA understands this!)
    • [X] Generate functions with MagicConstant annotation
  • [X] Critical Native function generations
  • [X] A few extensions, including emptyButton, dragVec4, sliderVec4, lineTo, circle, bufferingBar, dialogBox, spinner (Android style!), toggleButton (iOS style!), mostly from the issues and the communities.
  • [X] Integration of aiekick/ImGuiFileDialog as JImFileDialog
  • [X] Integration of Flix01/imguidatechooser as imgui.dateChooser

C++ interoperability

  • [X] Native value pointer (bool *, int *, float *) wrappers, providing accessValue and modifyValue
  • [X] ImVec4 wrapper with optional mutability
  • [X] ImTextureID wrapper with platform-dependent implementations
    • [X] LPDIRECT3DTEXTURE9 on WindowsXP+
    • [X] ID3D11ShaderResourceView* on Windows7+
    • [X] GLuint on MacOS/Linux

Backends and platforms

  • Linux native library with glfw3 + opengl3 implementation
    • [ ] 32-bit hosted on ?
    • [X] 64-bit hosted on CircleCI
  • WindowsXP+ native library
    • with glfw + opengl3 implementation (no longer maintained)
      • [ ] 32-bit hosted on ?
      • [ ] 64-bit hosted on ?
    • with directX9 implementation
      • [X] 32-bit hosted on my laptop
      • [X] 64-bit hosted on my laptop
  • Windows7+ native library with directX11 implementation
    • [X] 32-bit hosted on my laptop
    • [X] 64-bit hosted on my laptop
  • MacOS native library with Cocoa, glut as additions to Linux implementation

Usage

Remember to add jcenter to your repositories.

Code example

import org.ice1000.jimgui.JImGui;
import org.ice1000.jimgui.util.JniLoader;

public class Main {
  public static void main(String... args){
    JniLoader.load();
    try (JImGui imGui = new JImGui()) {
      // load fonts, global initializations, etc.
      while (!imGui.windowShouldClose()) {
        // some drawing-unrelated initializations
        // mostly do nothing here
        imGui.initNewFrame();
        // draw your widgets here, like this
        imGui.text("Hello, World!");
        imGui.render();
        // mostly do nothing here
      }
    }
  }
}

Kotlin DSL:

runPer(10) {
  "Window with Tabs" {
    tabBar("tab bar id") {
      tabItem("Tab One") { text("I am in Tab one!") }
      tabItem("Tab Two") { button("I am in Tab two!") }
      tabItem("Tab Three") { bulletText("I am in Tab three!") }
    }

    treeNode("PsiClassBody") {
      treeNode("PsiConstructor") {
        text("PsiIdentifier")
      }
      treeNode("PsiMethod") {
        text("PsiAnnotation")
        text("PsiLeafElement")
      }
    }
  }
}

Using Unicode strings

You can use ImGuiFontAtlas in order to extend glyph ranges for your font, which is needed if you want to display Unicode characters. You can find more info about glyph ranges at the dear-imgui repository.

Notice that in order to display Unicode characters you need to have your Java sources encoded and compiled as UTF-8. To compile the sources as UTF-8, add the following line to your build.gradle:

compileJava.options.encoding = 'UTF-8'

Gradle

import org.apache.tools.ant.taskdefs.condition.Os
// ...
repositories {
  // ...
  jcenter()
}
// ...
dependencies {
  String jimguiVersion = 'v0.18.0'
  implementation "org.ice1000.jimgui:core:$jimguiVersion" // basic functionality
  implementation "org.ice1000.jimgui:kotlin-dsl:$jimguiVersion" // kotlin dsl wrapper
}
// ...
tasks.withType(JavaExec).configureEach {
  if (Os.isFamily(Os.FAMILY_MAC)) jvmArgs "-XstartOnFirstThread"
}

Gradle Kotlin DSL

import org.apache.tools.ant.taskdefs.condition.Os
dependencies {
  val jimguiVersion = "v0.18.0"
  implementation("org.ice1000.jimgui:core:$jimguiVersion") // basic functionality
  implementation("org.ice1000.jimgui:kotlin-dsl:$jimguiVersion") // kotlin dsl wrapper
}

tasks.withType<JavaExec>().configureEach {
  if (Os.isFamily(Os.FAMILY_MAC)) jvmArgs("-XstartOnFirstThread")
}

Maven

<repositories>
  <repository>
    <id>jcenter</id>
    <url>https://jcenter.bintray.com</url>
  </repository>
</repositories>
<dependency>
  <groupId>org.ice1000.jimgui</groupId>
  <!-- basic functionality -->
  <artifactId>core</artifactId>
  <version>v0.18.0</version>
  <type>pom</type>
</dependency>

Build

First you need to make sure you have cmake newer than 3.14 and the following software installed:

  • For Linux
    • make
    • pkg-config
    • libglfw3-dev
  • For Windows (>= XP)
    • Visual Studio 2019 with msbuild (needs to be on PATH)
    • DirectX 9 Libraries (should be pre-installed on Windows or with Visual Studio)
    • DirectX SDK
  • For macOS
    • Everything needed on Linux
    • Frameworks including Cocoa, GLUT, OpenGL
    • Run with JVM Argument: -XstartOnFirstThread (You can use export _JAVA_OPTIONS='-XstartOnFirstThread')

To compile a jar library, run (you need to use the developer command prompt for this on Windows):

$ ./gradlew assemble

To run tests, run:

$ ./gradlew test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].