{"id":16101692,"url":"https://github.com/ice1000/jimgui","last_synced_at":"2025-04-07T17:12:33.835Z","repository":{"id":32137657,"uuid":"131628957","full_name":"ice1000/jimgui","owner":"ice1000","description":":sparkling_heart: Pure Java binding for dear-imgui","archived":false,"fork":false,"pushed_at":"2023-11-21T01:59:46.000Z","size":1279,"stargazers_count":187,"open_issues_count":10,"forks_count":13,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T15:18:44.780Z","etag":null,"topics":["dear-imgui","imgui","java","java-bindings"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ice1000.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ice1000","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-04-30T17:58:46.000Z","updated_at":"2025-03-26T18:32:15.000Z","dependencies_parsed_at":"2024-10-26T19:31:34.109Z","dependency_job_id":"4ba74cb9-b004-431b-8df0-fbda40f67b5f","html_url":"https://github.com/ice1000/jimgui","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice1000%2Fjimgui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice1000%2Fjimgui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice1000%2Fjimgui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ice1000%2Fjimgui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ice1000","download_url":"https://codeload.github.com/ice1000/jimgui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694877,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dear-imgui","imgui","java","java-bindings"],"created_at":"2024-10-09T18:50:41.657Z","updated_at":"2025-04-07T17:12:33.819Z","avatar_url":"https://github.com/ice1000.png","language":"Java","readme":"# jimgui\n\n[![Join the chat at https://gitter.im/imgui-java/community](https://badges.gitter.im/imgui-java/community.svg)](https://gitter.im/imgui-java/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Maven Central](https://img.shields.io/maven-central/v/org.ice1000.jimgui/core)][maven-link]\n\n  [maven-link]: https://mvnrepository.com/artifact/org.ice1000.jimgui/core\n\nLinux Build | Windows Build\n:----------:|:-------------:\n[![CCI][0]][1]|[![AV][2]][3]\n\n  [0]: https://circleci.com/gh/ice1000/jimgui.svg?style=svg\n  [1]: https://circleci.com/gh/ice1000/jimgui\n  [2]: https://ci.appveyor.com/api/projects/status/le5v5lne7au0lnn2?svg=true\n  [3]: https://ci.appveyor.com/project/ice1000/jimgui\n\nTo jcenter users: as the deprecation of jcenter, this library is now published to maven central since `v0.20`.\nPlease update your repository setting to reflect the change.\n\nCross-platform efficient pure Java binding for [dear-imgui](https://github.com/ocornut/imgui), Kotlin is used as code generation tool.\n\nThis binding is rather bare-metal, that reflects imgui's API directly. I think it's good enough, but you may expect some other styles of bindings.\n\nThere is a declarative wrapper of jimgui, namely [flui](https://github.com/newk5/flui) available.\n\n## Features\nCan be considered as both advantages and disadvantages.\n\n### Java\nIt is Java-only with an optional Kotlin DSL wrapper.\n\n### Pure\nIt hides everything about rendering behind-the-scene,\nso you don't need to worry about GLFW, OpenGL or DirectX stuffs\n(speaking of lwjgl or jogl integration -- see [#18], it's hard).\n\nAlso, it doesn't separate jars for different platforms. One jar works on all supported platforms.\n\n### Usability\nIt is well-known that dear imgui doesn't have image loading out-of-the-box,\nbut this library has, and it even has a wrapper for [aiekick/ImGuiFileDialog]\nand [Flix01/imguidatechooser] and some other minor widgets.\n\n### Efficiency\nThis is twofolded.\n\n+ JNI efficiency. It exploits [Critical Native] and it avoids accessing Java from C++.\n  Only arrays and primitive types are passed from Java to C++,\n  and only primitive types are returned.\n+ Optimization for strings. That jimgui by default uses an inefficient way to convert `java.lang.String` into byte arrays that C++ is happy with.\n  You can customize the string-to-bytes function yourself by using `org.ice1000.jimgui.util.JImGuiUtil.setStringToBytes`\n  the default caching `JImGuiUtil.cacheStringToBytes()`, or use the more efficient alternative to `java.lang.String` --\n  `org.ice1000.jimgui.JImStr`, which is supposed to be created as global constants.\n\n### IDE-friendliness\nIt exploits [JetBrains annotations], particularly with `MagicConstant`,\n`NotNull`, `Nullable` and `Contract`.\n\n`MagicConstant` annotation enables IntelliJ IDEA to provide completion for `int flags` arguments\nwith only the flags needed:\n\n![image](https://user-images.githubusercontent.com/16398479/102420233-9c558d80-403c-11eb-921c-9c68003fe923.png)\n\n [#18]: https://github.com/ice1000/jimgui/issues/18\n [JetBrains annotations]: https://www.jetbrains.com/help/idea/annotating-source-code.html\n\nThis project was created for a code editor and a game engine, both dead.\n\nFor macOS users, make sure you add `-XstartOnFirstThread` JVM argument when running applications built with jimgui.\n\n# Demo\n\n+ [Partial re-implementation of imgui_demo.cpp](core/test/org/ice1000/jimgui/tests/Demo.java).\n+ [A sample text editor](core/test/org/ice1000/jimgui/tests/EditorTest.java)\n+ [DrawList party](fun/src/dlparty/BigCollection.java), with a [YouTube video](https://youtu.be/ojgWnelaRfw)\n\n# Contents\n\n## Bindings to official features\n\n+ [X] `ImGui` namespace getter/setter/function/javadoc generation\n+ [X] `ImGuiFontAtlas`/`ImGuiStyle`/`ImGuiFont`/`ImGuiIO`/`ImGuiDrawList`\n       properties getter/setter/function/javadoc generation\n+ [X] `ImGui*Flags` constant/javadoc generation\n+ [X] `ImStyleVar` keys using generic parameter as type constraint (type safe!)\n\n## Extra convenience provided\n\n+ [X] Functions to access and modify platform window size/pos\n+ [X] Use `MagicConstant` annotation to specify where the constant parameters are from (IntelliJ IDEA understands this!)\n  + [X] Generate functions with `MagicConstant` annotation\n+ [X] [Critical Native] function generations\n+ [X] A few extensions, including `emptyButton`, `dragVec4`, `sliderVec4`, `lineTo`, `circle`,\n      `bufferingBar`, `dialogBox`, `spinner` (Android style!), `toggleButton` (iOS style!),\n      mostly from the issues and the communities.\n+ [X] Integration of [aiekick/ImGuiFileDialog] as `JImFileDialog`\n+ [X] Integration of [Flix01/imguidatechooser] as `imgui.dateChooser`\n\n [aiekick/ImGuiFileDialog]: https://github.com/aiekick/ImGuiFileDialog\n [Flix01/imguidatechooser]: https://github.com/Flix01/imgui/tree/imgui_with_addons/addons/imguidatechooser\n [Critical Native]: https://stackoverflow.com/a/36309652/7083401\n\n## C++ interoperability\n\n+ [X] Native value pointer (`bool *`, `int *`, `float *`) wrappers, providing `accessValue` and `modifyValue`\n+ [X] `ImVec4` wrapper with optional mutability\n+ [X] `ImTextureID` wrapper with platform-dependent implementations\n  + [X] `LPDIRECT3DTEXTURE9` on WindowsXP+\n  + [X] `ID3D11ShaderResourceView*` on Windows7+\n  + [X] `GLuint` on MacOS/Linux\n\n## Backends and platforms\n\n+ Linux native library with glfw3 + opengl3 implementation\n  + [ ] 32-bit hosted on ?\n  + [X] 64-bit amd64 hosted on CircleCI (Ubuntu 20.04)\n  + [X] 64-bit aarch64, loongarch64 built by @Glavo\n+ WindowsXP+ native library\n  + with glfw + opengl3 implementation (no longer maintained)\n    + [ ] 32-bit hosted on ?\n    + [ ] 64-bit hosted on ?\n  + with directX9 implementation\n    + [X] 32-bit hosted on my laptop\n    + [X] 64-bit hosted on my laptop\n+ Windows7+ native library with directX11 implementation\n  + [X] 32-bit hosted on my laptop\n  + [X] 64-bit hosted on my laptop\n+ MacOS native library with Cocoa, glut as additions to Linux implementation\n  + [X] built by @imkiva (built by @newk5 's VM in the past)\n\n# Usage\n\n## Code example\n\n```java\nimport org.ice1000.jimgui.JImGui;\nimport org.ice1000.jimgui.util.JniLoader;\n\npublic class Main {\n  public static void main(String... args){\n    JniLoader.load();\n    try (JImGui imGui = new JImGui()) {\n      // load fonts, global initializations, etc.\n      while (!imGui.windowShouldClose()) {\n        // some drawing-unrelated initializations\n        // mostly do nothing here\n        imGui.initNewFrame();\n        // draw your widgets here, like this\n        imGui.text(\"Hello, World!\");\n        imGui.render();\n        // mostly do nothing here\n      }\n    }\n  }\n}\n```\n\nKotlin DSL:\n\n```kotlin\nrunPer(10) {\n  \"Window with Tabs\" {\n    tabBar(\"tab bar id\") {\n      tabItem(\"Tab One\") { text(\"I am in Tab one!\") }\n      tabItem(\"Tab Two\") { button(\"I am in Tab two!\") }\n      tabItem(\"Tab Three\") { bulletText(\"I am in Tab three!\") }\n    }\n\n    treeNode(\"PsiClassBody\") {\n      treeNode(\"PsiConstructor\") {\n        text(\"PsiIdentifier\")\n      }\n      treeNode(\"PsiMethod\") {\n        text(\"PsiAnnotation\")\n        text(\"PsiLeafElement\")\n      }\n    }\n  }\n}\n```\n\n## Using Unicode strings\n\nYou can use `ImGuiFontAtlas` to extend glyph ranges for your font, which is needed if you want to display Unicode characters.\nYou can find more info about glyph ranges at the [dear-imgui repository](https://github.com/ocornut/imgui).\n\nNotice that 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`:\n\n```groovy\ncompileJava.options.encoding = 'UTF-8'\n```\n\n## Gradle\n\n```groovy\nimport org.apache.tools.ant.taskdefs.condition.Os\n// ...\ndependencies {\n  String jimguiVersion = 'v0.20.3'\n  implementation \"org.ice1000.jimgui:core:$jimguiVersion\" // basic functionality\n  implementation \"org.ice1000.jimgui:kotlin-dsl:$jimguiVersion\" // kotlin dsl wrapper\n}\n// ...\ntasks.withType(JavaExec).configureEach {\n  if (Os.isFamily(Os.FAMILY_MAC)) jvmArgs \"-XstartOnFirstThread\"\n}\n```\n\n## Gradle Kotlin DSL\n\n```kotlin\nimport org.apache.tools.ant.taskdefs.condition.Os\ndependencies {\n  val jimguiVersion = \"v0.20.3\"\n  implementation(\"org.ice1000.jimgui:core:$jimguiVersion\") // basic functionality\n  implementation(\"org.ice1000.jimgui:kotlin-dsl:$jimguiVersion\") // kotlin dsl wrapper\n}\n\ntasks.withType\u003cJavaExec\u003e().configureEach {\n  if (Os.isFamily(Os.FAMILY_MAC)) jvmArgs(\"-XstartOnFirstThread\")\n}\n```\n\n## Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.ice1000.jimgui\u003c/groupId\u003e\n  \u003c!-- basic functionality --\u003e\n  \u003cartifactId\u003ecore\u003c/artifactId\u003e\n  \u003cversion\u003ev0.20.3\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n# Build\n\nFirst you need to make sure you have `cmake` newer than 3.14 and the following software installed:\n\n+ For Linux\n  + `make`\n  + `pkg-config`\n  + `libglfw3-dev`\n+ For Windows (\\\u003e= XP)\n  + Visual Studio 2019 with `msbuild` (needs to be on PATH)\n  + DirectX 9 Libraries (should be pre-installed on Windows or with Visual Studio)\n  + [DirectX SDK](https://www.microsoft.com/en-us/download/details.aspx?id=6812)\n+ For macOS\n  + Everything needed on Linux\n  + Frameworks including `Cocoa`, `GLUT`, `OpenGL`\n  + Run with JVM Argument: `-XstartOnFirstThread`\n    (You can use `export _JAVA_OPTIONS='-XstartOnFirstThread'`)\n\nTo compile a jar library, run\n(you need to use the developer command prompt for this on Windows):\n\n```\n$ ./gradlew jar\n```\n\nTo run tests, run:\n\n```\n$ ./gradlew test\n```\n","funding_links":["https://github.com/sponsors/ice1000"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice1000%2Fjimgui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fice1000%2Fjimgui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fice1000%2Fjimgui/lists"}