[Build] CI refactor (#149)

* [Build] CI refactor

* [Build] Fix GenerateLibs

* [Build] Up actions/checkout@v3

* [Build] Remove actions/gradle-build-action

* [Build] Uncomment publish/release jobs

* [Build] Delete obsolete jobs

* [Build] Add more info to the jar manifest

* [Build] Make checkout to fetch tags

* [Build] Return job to update binaries

* [Doc] Update README
This commit is contained in:
SpaiR authored and GitHub committed 2022-12-12 21:45:50 +02:00
1 parent 62377c7b1d
commit 2957cb4b88
24 files changed
+290 -352

No files matched your search

+114 -37
View File
@@ -4,92 +4,169 @@ jobs:
build-java:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ ubuntu-latest, macos-latest ]
name: Build Java
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 8
uses: actions/setup-java@v1
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 8
distribution: liberica
- name: Build
uses: eskatos/gradle-command-action@v1
run: ./gradlew buildAll
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
arguments: buildAll
name: java-libraries
path: |
imgui-app/build/libs/*.jar
imgui-binding/build/libs/*.jar
imgui-lwjgl3/build/libs/*.jar
build-natives:
env:
FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
type: [win, linux, mac]
freetype: [true, false]
os: [ ubuntu-latest, macos-latest ]
type: [ windows, linux, macos ]
freetype: [ true, false ]
include:
- type: win
- type: windows
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
- type: linux
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
- type: mac
- type: macos
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
exclude:
- os: ubuntu-latest
type: mac
type: macos
- os: macos-latest
type: win
type: windows
- os: macos-latest
type: linux
name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }})
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository and Submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Setup Java 8
uses: actions/setup-java@v1
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 8
distribution: liberica
- name: Ant Version
run: ant -version
- if: matrix.os == 'ubuntu-latest'
name: Install MinGW-w64/GCC/G++
name: Install MinGW-w64/GCC/G++ (Linux & Windows)
run: sudo apt install mingw-w64
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
name: FreeType - Install
name: FreeType - Install (Linux)
run: sudo apt install libfreetype6-dev
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
name: FreeType - Download
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
name: FreeType - Install (Windows)
run: |
sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }}
sudo mkdir /freetype
sudo tar -xzf /freetype.tar.gz -C /freetype --strip-components=1
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
name: FreeType - Compile & Install
working-directory: /freetype
run: |
sudo tar -xzf ./vendor/freetype-2.12.1.tar.gz -C /freetype --strip-components=1
cd /freetype
sudo ./configure --with-zlib=no --with-bzip2=no --with-png=no --with-harfbuzz=no --with-brotli=no --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32
sudo make
sudo make install
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
run: ./gradlew imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
- name: Upload Native
uses: actions/upload-artifact@v2
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.freetype && 'freetype' || 'common' }}
path: ${{ matrix.expected }}
name: ${{ matrix.freetype && 'native-libraries-with-freetype' || 'native-libraries' }}
if-no-files-found: error
path: ${{ matrix.expected }}
update-bin:
if: github.ref == 'refs/heads/main' # runs only on the main branch
name: Update Binaries
runs-on: ubuntu-latest
needs: build-natives
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: /tmp/artifacts
- name: Update
run: |
mv /tmp/artifacts/native-libraries/* bin/
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
- name: Commit
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: '[ci skip] update native binaries'
release:
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
name: Release
runs-on: ubuntu-latest
needs: [ build-java, build-natives ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 8
distribution: liberica
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: out/artifacts
- name: Zip Artifacts
run: |
mkdir out/archives
zip -rj out/archives/native-libraries out/artifacts/native-libraries
zip -rj out/archives/native-libraries-with-freetype out/artifacts/native-libraries-with-freetype
zip -rj out/archives/java-libraries out/artifacts/java-libraries
- name: Publish
env:
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
run: |
chmod +x ./buildSrc/scripts/publish.sh
buildSrc/scripts/publish.sh
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: false
files: |
out/archives/**
-27
View File
@@ -1,27 +0,0 @@
name: Publish to Maven
on: workflow_dispatch
jobs:
publish-to-maven:
name: Publish to Maven
runs-on: ubuntu-latest
env:
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Repository
run: |
chmod +x ./buildSrc/scripts/release.sh
chmod +x ./gradlew
- name: Setup Java 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Release
run: ./buildSrc/scripts/release.sh
-60
View File
@@ -1,60 +0,0 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Up Version
uses: eskatos/gradle-command-action@v1
with:
arguments: ${{ format('upVersion -Pnext={0}', github.event.inputs.version) }}
- name: Commit Version
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: ${{ format('v{0}', github.event.inputs.version) }}
- name: Push Tag
uses: mathieudutour/github-tag-action@v5.5
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ github.event.inputs.version }}
- name: Build All
uses: eskatos/gradle-command-action@v1
with:
arguments: buildAll
- name: Generate Changelog
id: changelog
uses: metcalfc/changelog-generator@v1.0.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ steps.changelog.outputs.changelog }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
draft: true
prerelease: false
files: |
imgui-app/build/libs/*.jar
imgui-binding/build/libs/*.jar
imgui-lwjgl3/build/libs/*.jar
bin/imgui-java64.dll
bin/libimgui-java64.dylib
bin/libimgui-java64.so
-28
View File
@@ -1,28 +0,0 @@
name: Update Natives
on: workflow_dispatch
jobs:
update-natives:
name: Update Natives
runs-on: ubuntu-latest
steps:
- name: Download Natives
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci.yml
branch: main
event: push
path: /tmp/artifacts
- name: Checkout Repository
uses: actions/checkout@v2
- name: Update Natives
run: |
mv /tmp/artifacts/common/* bin/
mv /tmp/artifacts/freetype/* bin/freetype/
- name: Commit Natives
uses: EndBug/add-and-commit@v7
with:
default_author: github_actions
message: '[ci skip] Update native binaries'
+2 -1
View File
@@ -25,10 +25,11 @@ logs/
*.tar.gz
*.rar
*.gpg
!vendor/freetype-2.12.1.tar.gz
# Gradle
.gradletasknamecache
.gradle/
!gradle/wrapper/*.jar
build/
out/
!gradle/wrapper/*.jar
+113 -72
View File
@@ -1,37 +1,50 @@
# imgui-java
<div align="center">
# ImGui Java
#### JNI based binding for [Dear ImGui](https://github.com/ocornut/imgui)
[![Github All Releases](https://img.shields.io/github/downloads/SpaiR/imgui-java/total.svg?logo=github)](https://github.com/SpaiR/imgui-java/releases)
[![CI](https://github.com/SpaiR/imgui-java/actions/workflows/ci.yml/badge.svg)](https://github.com/SpaiR/imgui-java/actions/workflows/ci.yml)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.spair/imgui-java-binding?logo=apache-maven)](https://search.maven.org/search?q=g:io.github.spair%20AND%20a:imgui-java-*)
[![CI](https://github.com/SpaiR/imgui-java/actions/workflows/ci.yml/badge.svg)](https://github.com/SpaiR/imgui-java/actions/workflows/ci.yml)
[![binding javadoc](https://javadoc.io/badge2/io.github.spair/imgui-java-binding/javadoc_binding.svg?logo=java)](https://javadoc.io/doc/io.github.spair/imgui-java-binding)
[![app javadoc](https://javadoc.io/badge2/io.github.spair/imgui-java-app/javadoc_app.svg?logo=java)](https://javadoc.io/doc/io.github.spair/imgui-java-app)
</div>
---
JNI based binding for [Dear ImGui](https://github.com/ocornut/imgui) with no dependencies.<br>
Read official [documentation](https://github.com/ocornut/imgui#usage) and [wiki](https://github.com/ocornut/imgui/wiki) to see how to work with Dear ImGui.
Almost everything from C++ could be done in Java in the same way.
Binding has an OpenGL renderer and a GLFW backend implementation, using a [LWJGL3](https://www.lwjgl.org/) library. Could be found in [imgui-lwjgl3](https://github.com/SpaiR/imgui-java/blob/v1.86.4/imgui-lwjgl3) module.<br>
They are recommended, yet optional to use. The advantage of Dear ImGui is a portability, so feel free to copy-paste classes or write your own implementations.<br>
Additionally, there is an [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.86.4/imgui-app) module, which provides **a high abstraction layer**.<br>
It hides all low-level stuff under one class to extend, so you can build your GUI application instantly.
### Features
- **JNI based**<br>
Native communication layer made with generated JNI code. No dependencies, no problems.
- **Small and Efficient**<br>
Binding has a very small memory footprint and uses direct native calls to work.<br>
Binding has a small memory footprint and uses direct native calls to work.<br>
- **Fully Featured**<br>
All public API was carefully implemented with Java usage in mind.<br>
- **Multi-Viewports/Docking Branch**<br>
- **Multi-Viewports / Docking Branch**<br>
Binding has a full support of [Multi-Viewports](https://github.com/ocornut/imgui/wiki/Multi-Viewports) and [Docking](https://github.com/ocornut/imgui/wiki/Docking). <br>
- **FreeType Font Renderer**<br>
FreeType font renderer provides a much better fonts quality. [See how to use](#freetype).<br>
- **Extensions**<br>
Binding includes several useful [extensions](https://github.com/ocornut/imgui/wiki/Useful-Extensions) for Dear ImGui. [See full list](#extensions).
To understand how to use ImGui Java - read official [documentation](https://github.com/ocornut/imgui#usage) and [wiki](https://github.com/ocornut/imgui/wiki).
Binding adopts C++ API for Java, but almost everything can be used in the same manner.
ImGui Java has a ready to use implementation for GLFW and OpenGL API using [LWJGL3](https://www.lwjgl.org/) library. See `imgui-lwjgl3` module.<br>
Implementation is optional, yet optional to use. Advantage of Dear ImGui is total portability, so feel free to copy-paste classes or write your own implementations.
Additionally, there is an `imgui-app` module, which provides **a high abstraction layer**.<br>
It hides all low-level code under one class to extend. With it, you can build your GUI application instantly.
# Support
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/P5P5BF17Q)
You can support the project to motivate its further development.
# How to Try
_Make sure you have installed Java 8 or higher._
_**Make sure you have installed <u>JDK 8</u> or higher.**_
<p align="center"><img src="https://i.imgur.com/JjhR9in.png"/></p>
@@ -40,27 +53,36 @@ _Make sure you have installed Java 8 or higher._
You can try binding by yourself in three simple steps:
```
git clone --branch v1.86.4 https://github.com/SpaiR/imgui-java.git
git clone git@github.com:SpaiR/imgui-java.git
cd imgui-java
./gradlew :example:run
```
See [example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example) module to try other widgets in action.
See `example` module to try other widgets in action.
# How to Use
**[ImGui in LWJGL YouTube video](https://youtu.be/Xq-eVcNtUbw)** by [GamesWithGabe](https://www.youtube.com/channel/UCQP4qSCj1eHMHisDDR4iPzw).<br>
You can use this video as a basic step-by-step tutorial. It shows how to integrate binding with the usage of jar files. Gradle and Maven dependecies could be used for this purpose as well.
Take a note, that integration itself is a very flexible process. It could be done in one way or another. If you just need a framework for your GUI - use **Application** module. Otherwise, if you need more control, the best way is not just to repeat steps, but to understand what each step does.
**[ImGui in LWJGL YouTube video](https://youtu.be/Xq-eVcNtUbw)** by [GamesWithGabe](https://www.youtube.com/channel/UCQP4qSCj1eHMHisDDR4iPzw).<br>
You can use this video as a basic step-by-step tutorial. It shows how to integrate binding with the usage of jar files.<br>
Gradle and Maven dependencies could be used for this purpose as well.
Take a note, that integration itself is a very flexible process. It could be done in one way or another. If you just need a framework for your GUI - use [Application](#application) module.
Otherwise, if you need more control, the best way is not just to repeat steps, but to understand what each step does.
## Application
If you don't care about OpenGL or other low-level stuff, then you can use application layer from [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.86.4/imgui-app) module.
It is a **one jar solution** which includes: GLFW, OpenGL and Dear ImGui itself. So you only need **one dependency** line or **one jar in classpath** to make everything to work. <ins>You don't need to add separate dependencies to LWJGL or native libraries, since they are already included.</ins><br>
Application module is the best choice if everything you care is the GUI for your app.
At the same time, Application gives an option to override any life-cycle method it has. That means that if you're seeking for a bit more low-level control - you can gain it too.
If you don't care about OpenGL and other low-level stuff, then you can use application layer from `imgui-app` module.
It is a **one jar solution** which includes: GLFW, OpenGL and Dear ImGui itself.
So you only need **one dependency** line or **one jar in classpath** to make everything to work.
<ins>You don't need to add separate dependencies to LWJGL or native libraries, since they are already included.</ins>
**Application module is the best choice if everything you care is the GUI itself.**
At the same time, Application gives options to override any life-cycle method it has.
That means that if you are seeking for a bit more low-level control - you can gain it as well.
### Example
#### Example
A very simple application may look like this:
```
import imgui.ImGui;
@@ -82,9 +104,12 @@ public class Main extends Application {
}
}
```
Read `imgui.app.Application` [javadoc](https://javadoc.io/doc/io.github.spair/imgui-java-app) to understand how it works under the hood.
#### Dependencies
### Dependencies
![Maven Central](https://img.shields.io/maven-central/v/io.github.spair/imgui-java-binding?color=green&label=Version%20to%20use&style=flat-square)
<details>
<summary><b>Gradle</b></summary>
@@ -95,7 +120,7 @@ repositories {
}
dependencies {
implementation "io.github.spair:imgui-java-app:1.86.4"
implementation "io.github.spair:imgui-java-app:${version}"
}
```
</details>
@@ -108,7 +133,7 @@ dependencies {
<dependency>
<groupId>io.github.spair</groupId>
<artifactId>imgui-java-app</artifactId>
<version>1.86.4</version>
<version>${version}</version>
</dependency>
</dependencies>
```
@@ -123,16 +148,19 @@ dependencies {
</details>
#### Java Module System
If using Java 9 modules, you will need to require the `imgui.app` module.
## Binding
Using binding without the wrapper requires to "attach" it to your application manually.
You can refer to [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.86.4/imgui-app) module and see how things are done there.
Using binding without `imgui-app` module requires to "attach" it to the application manually.
You can refer to `imgui-app` module to see how things are done there.
### Dependencies
For simplicity, example of dependencies for Gradle/Maven only shows how to add natives for Windows.
Feel free to add other platforms.
![Maven Central](https://img.shields.io/maven-central/v/io.github.spair/imgui-java-binding?color=green&label=Version%20to%20use&style=flat-square)
For simplicity, example of dependencies for Gradle / Maven only shows how to add natives for Windows. Feel free to add other platforms.
| Native Binaries | System |
|----------------------------|---------|
@@ -140,7 +168,7 @@ Feel free to add other platforms.
| imgui-java-natives-linux | Linux |
| imgui-java-natives-macos | macOS |
Take a note, that you also need to add dependencies to [LWJGL](https://www.lwjgl.org/). Examples below shows how to do it as well.
Take a note, that you also need to add dependencies to [LWJGL](https://www.lwjgl.org/) library. Examples below shows how to do it as well.
<details>
<summary><b>Gradle</b></summary>
@@ -152,7 +180,7 @@ repositories {
ext {
lwjglVersion = '3.3.1'
imguiVersion = '1.86.4'
imguiVersion = "${version}"
}
dependencies {
@@ -177,7 +205,7 @@ dependencies {
```
<properties>
<lwjgl.version>3.3.1</lwjgl.version>
<imgui.java.version>1.86.4</imgui.java.version>
<imgui.java.version>${version}</imgui.java.version>
</properties>
<dependencyManagement>
@@ -253,7 +281,8 @@ dependencies {
</details>
#### Java Module System
If using Java 9 modules, imgui-java has Automatic Module Names:
If using Java 9 modules, ImGui Java has Automatic Module Names:
| Package | Module |
|----------------------------|-----------------------|
@@ -265,29 +294,36 @@ If using Java 9 modules, imgui-java has Automatic Module Names:
| imgui-java-natives-macos | imgui.natives.macos |
## Extensions
- [ImNodes](https://github.com/Nelarius/imnodes/tree/857cc860af05ac0f6a4039c2af33d982377b6cf4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImNodes.java) <br>
A small, dependency-free node editor for dear imgui. (A good choice for simple start.)
- [imgui-node-editor](https://github.com/thedmd/imgui-node-editor/tree/687a72f940c76cf5064e13fe55fa0408c18fcbe4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImGuiNodeEditor.java) <br>
All extensions are already included in the binding and can be used as it is.
See examples in the `example` module for more information about how to use them.
- [ImNodes](https://github.com/Nelarius/imnodes/tree/857cc860af05ac0f6a4039c2af33d982377b6cf4) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImNodes.java) <br>
A small, dependency-free node editor for Dear ImGui. (A good choice for simple start.)
- [imgui-node-editor](https://github.com/thedmd/imgui-node-editor/tree/687a72f940c76cf5064e13fe55fa0408c18fcbe4) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImGuiNodeEditor.java) <br>
Node Editor using ImGui. (A bit more complex than ImNodes, but has more features.)
- [ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo/tree/f7bbbe39971d9d45816417a70e9b53a0f698c56e) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImGuizmo.java) <br>
Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui.
- [implot](https://github.com/epezent/implot/tree/555ff688a8134bc0c602123149abe9c17d577475) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImPlot.java) <br>
- [ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo/tree/f7bbbe39971d9d45816417a70e9b53a0f698c56e) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImGuizmo.java) <br>
Immediate mode 3D gizmo for scene editing and other controls based on Dear ImGui.
- [implot](https://github.com/epezent/implot/tree/555ff688a8134bc0c602123149abe9c17d577475) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImPlot.java) <br>
Advanced 2D Plotting for Dear ImGui.
- [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit/tree/0a88824f7de8d0bd11d8419066caa7d3469395c4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImGuiColorTextEdit.java) <br>
- [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit/tree/0a88824f7de8d0bd11d8419066caa7d3469395c4) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImGuiColorTextEdit.java) <br>
Syntax highlighting text editor for ImGui.
- [ImGuiFileDialog](https://github.com/aiekick/ImGuiFileDialog/tree/4d42dfba125cbd4780a90fbc5f75e7dfbae64060) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImGuiFileDialog.java) <br>
- [ImGuiFileDialog](https://github.com/aiekick/ImGuiFileDialog/tree/4d42dfba125cbd4780a90fbc5f75e7dfbae64060) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImGuiFileDialog.java) <br>
A file selection dialog built for ImGui.
- [ImGui Club MemoryEditor](https://github.com/ocornut/imgui_club/tree/d4cd9896e15a03e92702a578586c3f91bbde01e8) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.86.4/example/src/main/java/ExampleImGuiMemoryEditor.java) <br>
- [ImGui Club MemoryEditor](https://github.com/ocornut/imgui_club/tree/d4cd9896e15a03e92702a578586c3f91bbde01e8) | [Example](https://github.com/SpaiR/imgui-java/blob/main/example/src/main/java/ExampleImGuiMemoryEditor.java) <br>
Memory editor and viewer for ImGui.
## Freetype
By default, Dear ImGui uses stb-truetype to render fonts. Yet there is an option to use FreeType font renderer. Go to the [imgui_freetype](https://github.com/ocornut/imgui/tree/256594575d95d56dda616c544c509740e74906b4/misc/freetype) to read about the difference.
Binding has this option too. Freetype especially useful when you use custom font with small (~<16px) size. If you use the default font or a large font, stb will be fine for you.
By default, Dear ImGui uses stb-truetype to render fonts. Yet there is an option to use FreeType font renderer.
Go to the [imgui_freetype](https://github.com/ocornut/imgui/tree/256594575d95d56dda616c544c509740e74906b4/misc/freetype) to read about the difference.
Binding has this option too. Freetype especially useful when you use custom font with small (~<16px) size.
If you use the default font or a large font, stb will be fine for you.
There are two types of precompiled binaries: 1. with stb (the default one) 2. with freetype.
You can decide by yourself, which kind of libraries for any system you want to use.
Take a note, that for Linux and Mac users using of freetype will add an additional dependency to the `libfreetype` itself.
Take a note, that for Linux and macOS users using of freetype will add a dependency to the `libfreetype` itself.
This is not the case for Windows users, since `dll` binaries are compiled fully statically and already include freetype in themselves.
**For fully portable application** use default binaries.<br>
@@ -296,11 +332,14 @@ You can still use freetype binaries for Windows builds without worry though.
**For better fonts** use freetype binaries.<br>
Don't forget to make clear for your Linux/Mac users, that they will need to install freetype on their systems as well.
### How To Use FreeType
- Maven/Gradle:<br>
Use the same native libraries as you would, but with `-ft` suffix in the end.
<details>
<summary><b>Modified Gradle Example</b></summary>
### Dependencies
![Maven Central](https://img.shields.io/maven-central/v/io.github.spair/imgui-java-binding?color=green&label=Version%20to%20use&style=flat-square)
Use the same native libraries as you would, but with `-ft` suffix in the end.
<details>
<summary><b>Modified Gradle Example</b></summary>
```
repositories {
@@ -309,7 +348,7 @@ Don't forget to make clear for your Linux/Mac users, that they will need to inst
ext {
lwjglVersion = '3.3.1'
imguiVersion = '1.86.4'
imguiVersion = "${version}"
}
dependencies {
@@ -327,8 +366,7 @@ Don't forget to make clear for your Linux/Mac users, that they will need to inst
implementation "io.github.spair:imgui-java-natives-windows-ft:$imguiVersion"
}
```
</details>
- If you're using raw dll/so files, go to the `bin/freetype` folder and take them from there.
</details>
| Native Binaries With FreeType | System |
|-------------------------------|---------|
@@ -336,8 +374,11 @@ Don't forget to make clear for your Linux/Mac users, that they will need to inst
| imgui-java-natives-linux-ft | Linux |
| imgui-java-natives-macos-ft | macOS |
If you're using raw dll/so files, go to the `bin/freetype` folder and take them from there.
# Binding Notice
Binding was made with java usage in mind. Some places of the original library were adapted for that.<br>
Binding was made with Java usage in mind. Some places of the original library were adapted for that.<br>
For example, in places where in C++ you need to pass a reference value, in Java you pass primitive wrappers: `ImInt`, `ImFloat` etc.<br>
One important thing is how natives structs work. All of them have a public field with a pointer to the natively allocated memory.<br>
@@ -347,36 +388,36 @@ Most of the time you can ignore this fact and just work with objects in a common
Read [javadoc](https://javadoc.io/doc/io.github.spair/imgui-java-binding) and source comments to get more info about how to do specific stuff.
# How to Build Native Libraries
Ensure you've downloaded git submodules. That could be achieved:
- When cloning the repository: `git clone --recurse-submodules https://github.com/SpaiR/imgui-java.git`
- When the repository cloned: `git submodule init` + `git submodule update`
### Windows
- Make sure you have installed and **available in PATH**:
* Java 8 or higher
* JDK 8 or higher
* Ant
* Mingw-w64 (recommended way: use [MSYS2](https://www.msys2.org/) and install [mingw-w64-x86_64-toolchain](https://packages.msys2.org/group/mingw-w64-x86_64-toolchain) group)
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=win -Dlocal`
- Run with: `./gradlew :example:run -PlibPath="../imgui-binding/build/libsNative/windows64"`
- Build with: `./gradlew imgui-binding:generateLibs -Denvs=windows -Dlocal`
- Run with: `./gradlew example:run -PlibPath="../imgui-binding/build/libsNative/windows64"`
### Linux
- Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. (Package names could vary from system to system.)
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=linux -Dlocal`
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/linux64`
- Build with: `./gradlew imgui-binding:generateLibs -Denvs=linux -Dlocal`
- Run with: `./gradlew example:run -PlibPath=../imgui-binding/build/libsNative/linux64`
### macOS
- Check dependencies from "Linux" section and make sure you have them installed.
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=mac -Dlocal`
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/macosx64`
In `envs` parameter next values could be used `win`, `linux` or `mac`.<br>
- Check dependencies from "Linux" section and make sure you have them installed.
- Build with: `./gradlew imgui-binding:generateLibs -Denvs=macos -Dlocal`
- Run with: `./gradlew example:run -PlibPath=../imgui-binding/build/libsNative/macosx64`
In `envs` parameter next values could be used `windows`, `linux` or `macos`.<br>
`-Dlocal` is optional and means that natives will be built under the `./imgui-binding/build/` folder. Otherwise `/tmp/imgui` folder will be used.
On Windows always use local build.
# Support
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/P5P5BF17Q)
You can support the project to motivate its further development.
# License
See the LICENSE file for license rights and limitations (Apache-2.0).
+26 -6
View File
@@ -1,4 +1,4 @@
import tool.UpVersion
import java.text.SimpleDateFormat
ext {
lwjglVersion = '3.3.1'
@@ -6,19 +6,39 @@ ext {
allprojects {
group 'imgui-java'
version property('version')
version 'git describe --tags --always'.execute().text.trim().substring(1)
repositories {
mavenCentral()
}
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile).tap {
configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
tasks.withType(Jar).tap {
configureEach {
from(project.rootDir) {
include 'LICENSE'
}
manifest {
attributes (
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(System.currentTimeMillis()),
'Build-Revision': 'git rev-parse HEAD'.execute().text.trim(),
'Build-Jdk': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Created-By': "Gradle ${gradle.gradleVersion}"
)
}
}
}
}
tasks.register('upVersion', UpVersion)
tasks.register('buildAll') { t ->
t.group = 'build'
t.description = 'Build all project sources.'
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../../imgui-binding || exit
../gradlew clean generateLibs -Denvs=$* -Dlocal -Dfreetype=true
rm -frd libsNative
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../../imgui-binding || exit
rm -frd /tmp/imgui
../gradlew clean generateLibs -Denvs=$* -Dfreetype=true
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../../imgui-binding || exit
../gradlew clean generateLibs -Denvs=$* -Dlocal
rm -frd libsNative
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../../imgui-binding || exit
rm -frd /tmp/imgui
../gradlew clean generateLibs -Denvs=$*
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../.. || exit
mkdir ./bin/freetype
[ -e "/tmp/imgui/libsNative/windows32/imgui-java.dll" ] && cp /tmp/imgui/libsNative/windows32/imgui-java.dll ./bin/freetype
[ -e "/tmp/imgui/libsNative/windows64/imgui-java64.dll" ] && cp /tmp/imgui/libsNative/windows64/imgui-java64.dll ./bin/freetype
[ -e "/tmp/imgui/libsNative/linux32/libimgui-java.so" ] && cp /tmp/imgui/libsNative/linux32/libimgui-java.so ./bin/freetype
[ -e "/tmp/imgui/libsNative/linux64/libimgui-java64.so" ] && cp /tmp/imgui/libsNative/linux64/libimgui-java64.so ./bin/freetype
[ -e "/tmp/imgui/libsNative/macosx64/libimgui-java64.dylib" ] && cp /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib ./bin/freetype
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../.. || exit
[ -e "/tmp/imgui/libsNative/windows32/imgui-java.dll" ] && cp /tmp/imgui/libsNative/windows32/imgui-java.dll ./bin
[ -e "/tmp/imgui/libsNative/windows64/imgui-java64.dll" ] && cp /tmp/imgui/libsNative/windows64/imgui-java64.dll ./bin
[ -e "/tmp/imgui/libsNative/linux32/libimgui-java.so" ] && cp /tmp/imgui/libsNative/linux32/libimgui-java.so ./bin
[ -e "/tmp/imgui/libsNative/linux64/libimgui-java64.so" ] && cp /tmp/imgui/libsNative/linux64/libimgui-java64.so ./bin
[ -e "/tmp/imgui/libsNative/macosx64/libimgui-java64.dylib" ] && cp /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib ./bin
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../.. || exit
echo '> Publishing Modules...'
echo '>> Module [imgui-app]'
./gradlew imgui-app:publishImguiPublicationToMavenCentralRepository
echo '>> Module [imgui-lwjgl3]'
./gradlew imgui-lwjgl3:publishImguiPublicationToMavenCentralRepository
echo '>> Module [imgui-binding]'
./gradlew imgui-binding:publishImguiPublicationToMavenCentralRepository
echo '> Publishing Natives...'
echo '>> Natives: [windows, freetype]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=windows -Pfreetype=true
echo '>> Natives: [windows]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=windows -Pfreetype=false
echo '>> Natives: [linux, freetype]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=true
echo '>> Natives: [linux]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=false
echo '>> Natives: [macOS, freetype]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=macos -Pfreetype=true
echo '>> Natives: [macOS]'
./gradlew imgui-binding-natives:publishImguiPublicationToMavenCentralRepository -PdeployType=macos -Pfreetype=false
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
cd $BASEDIR/../.. || exit
echo '> Publishing Modules...'
echo '>> Module [imgui-app]'
./gradlew :imgui-app:publishMavenJavaPublicationToMavenCentralRepository
echo '>> Module [imgui-lwjgl3]'
./gradlew :imgui-lwjgl3:publishMavenJavaPublicationToMavenCentralRepository
echo '>> Module [imgui-binding]'
./gradlew :imgui-binding:publishMavenJavaPublicationToMavenCentralRepository
echo '> Publishing Natives...'
echo '>> Natives: [win & freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=win -Pfreetype=true
echo '>> Natives: [win & no freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=win -Pfreetype=false
echo '>> Natives: [linux & freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=true
echo '>> Natives: [linux & no freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=linux -Pfreetype=false
echo '>> Natives: [mac & freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=mac -Pfreetype=true
echo '>> Natives: [mac & no freetype]'
./gradlew :imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType=mac -Pfreetype=false
@@ -1,35 +0,0 @@
package tool
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
class UpVersion extends DefaultTask {
@Internal
String group = 'build'
@Internal
String description = 'Up project version to the next one.'
@TaskAction
void up() {
String currentVersion = project.findProperty('version')
String nextVersion = project.findProperty('next')
if (!currentVersion) {
throw new IllegalStateException('No property was found: "version"')
}
if (!nextVersion) {
throw new IllegalStateException('No property was found: "next"')
}
println "Up project version: $nextVersion..."
println 'Updating gradle.properties...'
def propsFile = project.file('gradle.properties')
propsFile.text = propsFile.text.replace("version=$currentVersion", "version=$nextVersion")
println 'Updating README.md...'
def readmeFile = project.file('README.md')
readmeFile.text = readmeFile.text.replace(currentVersion, nextVersion)
}
}
@@ -16,9 +16,9 @@ class GenerateLibs extends DefaultTask {
String description = 'Generate imgui-java native binaries.'
private final String[] buildEnvs = System.getProperty('envs')?.split(',')
private final boolean forWindows = buildEnvs?.contains('win')
private final boolean forWindows = buildEnvs?.contains('windows')
private final boolean forLinux = buildEnvs?.contains('linux')
private final boolean forMac = buildEnvs?.contains('mac')
private final boolean forMac = buildEnvs?.contains('macos')
private final boolean isLocal = System.properties.containsKey('local')
private final boolean withFreeType = Boolean.valueOf(System.properties.getProperty('freetype', 'false'))
-1
View File
@@ -1 +0,0 @@
version=1.86.4
+1 -1
View File
@@ -48,4 +48,4 @@ shadowJar {
}
apply from: "$rootDir/publish.gradle"
configurePublishing('imgui-java-app', 'Application wrapper for Dear ImGui')
configurePublishing('imgui-java-app', 'Application wrapper for Dear ImGui', project.version)
+1 -1
View File
@@ -48,4 +48,4 @@ jar {
}
apply from: "$rootDir/publish.gradle"
configurePublishing(packageName, packageDesc)
configurePublishing(packageName, packageDesc, project.version)
+1 -1
View File
@@ -21,7 +21,7 @@ tasks.register('generateLibs', GenerateLibs) {
}
apply from: "$rootDir/publish.gradle"
configurePublishing('imgui-java-binding', 'JNI based binding for Dear ImGui')
configurePublishing('imgui-java-binding', 'JNI based binding for Dear ImGui', project.version)
jar {
manifest {
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies {
}
apply from: "$rootDir/publish.gradle"
configurePublishing('imgui-java-lwjgl3', 'Backend LWJGL3 implementation for imgui-java')
configurePublishing('imgui-java-lwjgl3', 'Backend LWJGL3 implementation for imgui-java', project.version)
jar {
manifest {
+3 -3
View File
@@ -1,4 +1,4 @@
ext.configurePublishing = { packageName, packageDesc ->
ext.configurePublishing = { packageName, packageDesc, packageVersion ->
tasks.register('sourcesJar', Jar) {
it.dependsOn classes
it.archiveClassifier.set('sources')
@@ -23,10 +23,10 @@ ext.configurePublishing = { packageName, packageDesc ->
}
}
publications {
mavenJava(MavenPublication) {
imgui(MavenPublication) {
groupId = 'io.github.spair'
artifactId = packageName
version = property('version')
version = packageVersion
from components.java
artifact sourcesJar
BIN
View File
Binary file not shown.