[Doc] Move documentation to docs folder
This commit is contained in:
3 files changed
No files matched your search
@@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
despsolver@gmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
@@ -0,0 +1,43 @@
|
||||
# Contributing to imgui-java
|
||||
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
||||
|
||||
- Reporting a bug
|
||||
- Discussing the current state of the code
|
||||
- Submitting a fix
|
||||
- Proposing new features
|
||||
- Becoming a maintainer
|
||||
|
||||
## We Develop with Github
|
||||
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
||||
|
||||
## We Use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow), So All Code Changes Happen Through Pull Requests
|
||||
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). We actively welcome your pull requests:
|
||||
|
||||
1. Fork the repo and create your branch from `main`.
|
||||
2. Make sure your code lints.
|
||||
3. Issue that pull request!
|
||||
|
||||
## Any contributions you make will be under the Apache License 2.0
|
||||
In short, when you submit code changes, your submissions are understood to be under the same [Apache-2.0 License](https://choosealicense.com/licenses/apache-2.0/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
|
||||
## Report bugs using Github's [issues](https://github.com/SpaiR/imgui-java/issues)
|
||||
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy!
|
||||
|
||||
## Write bug reports with detail, background, and sample code
|
||||
**Great Bug Reports** tend to have:
|
||||
|
||||
- A quick summary and/or background
|
||||
- Steps to reproduce
|
||||
- Be specific!
|
||||
- Give sample code if you can.
|
||||
- What you expected would happen
|
||||
- What actually happens
|
||||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
||||
|
||||
People *love* thorough bug reports. I'm not even kidding.
|
||||
|
||||
## Use a Consistent Coding Style
|
||||
You can run `./gradlew check` to verify your changes beforehand.
|
||||
|
||||
## License
|
||||
By contributing, you agree that your contributions will be licensed under its Apache-2.0 License.
|
||||
+382
@@ -0,0 +1,382 @@
|
||||
# imgui-java
|
||||
|
||||
[](https://github.com/SpaiR/imgui-java/releases)
|
||||
[](https://github.com/SpaiR/imgui-java/actions/workflows/ci.yml)
|
||||
[](https://search.maven.org/search?q=g:io.github.spair%20AND%20a:imgui-java-*)
|
||||
[](https://javadoc.io/doc/io.github.spair/imgui-java-binding)
|
||||
[](https://javadoc.io/doc/io.github.spair/imgui-java-app)
|
||||
|
||||
---
|
||||
|
||||
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
|
||||
- **Small and Efficient**<br>
|
||||
Binding has a very 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>
|
||||
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).
|
||||
|
||||
# How to Try
|
||||
_Make sure you have installed Java 8 or higher._
|
||||
|
||||
<p align="center"><img src="https://i.imgur.com/JjhR9in.png"/></p>
|
||||
|
||||
### [Demo](https://i.imgur.com/c0ds1EZ.gif)
|
||||
|
||||
You can try binding by yourself in three simple steps:
|
||||
|
||||
```
|
||||
git clone --branch v1.86.4 https://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.
|
||||
|
||||
# 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.
|
||||
|
||||
## 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.
|
||||
|
||||
#### Example
|
||||
A very simple application may look like this:
|
||||
```
|
||||
import imgui.ImGui;
|
||||
import imgui.app.Application;
|
||||
|
||||
public class Main extends Application {
|
||||
@Override
|
||||
protected void configure(Configuration config) {
|
||||
config.setTitle("Dear ImGui is Awesome!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
ImGui.text("Hello, World!");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(new Main());
|
||||
}
|
||||
}
|
||||
```
|
||||
Read `imgui.app.Application` [javadoc](https://javadoc.io/doc/io.github.spair/imgui-java-app) to understand how it works under the hood.
|
||||
|
||||
#### Dependencies
|
||||
|
||||
<details>
|
||||
<summary><b>Gradle</b></summary>
|
||||
|
||||
```
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.github.spair:imgui-java-app:1.86.4"
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Maven</b></summary>
|
||||
|
||||
```
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.spair</groupId>
|
||||
<artifactId>imgui-java-app</artifactId>
|
||||
<version>1.86.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Raw Jar</b></summary>
|
||||
|
||||
1. Go to the [release page](https://github.com/SpaiR/imgui-java/releases/latest);
|
||||
2. Download `imgui-app-${version}.jar`;
|
||||
3. Add the jar to your classpath.
|
||||
</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.
|
||||
|
||||
### Dependencies
|
||||
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 |
|
||||
|----------------------------|---------|
|
||||
| imgui-java-natives-windows | Windows |
|
||||
| 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.
|
||||
|
||||
<details>
|
||||
<summary><b>Gradle</b></summary>
|
||||
|
||||
```
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
ext {
|
||||
lwjglVersion = '3.3.1'
|
||||
imguiVersion = '1.86.4'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
|
||||
|
||||
['', '-opengl', '-glfw'].each {
|
||||
implementation "org.lwjgl:lwjgl$it:$lwjglVersion"
|
||||
implementation "org.lwjgl:lwjgl$it::natives-windows"
|
||||
}
|
||||
|
||||
implementation "io.github.spair:imgui-java-binding:$imguiVersion"
|
||||
implementation "io.github.spair:imgui-java-lwjgl3:$imguiVersion"
|
||||
|
||||
implementation "io.github.spair:imgui-java-natives-windows:$imguiVersion"
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Maven</b></summary>
|
||||
|
||||
```
|
||||
<properties>
|
||||
<lwjgl.version>3.3.1</lwjgl.version>
|
||||
<imgui.java.version>1.86.4</imgui.java.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-bom</artifactId>
|
||||
<version>${lwjgl.version}</version>
|
||||
<scope>import</scope>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-glfw</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-opengl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl</artifactId>
|
||||
<classifier>natives-windows</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-glfw</artifactId>
|
||||
<classifier>natives-windows</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
<artifactId>lwjgl-opengl</artifactId>
|
||||
<classifier>natives-windows</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.spair</groupId>
|
||||
<artifactId>imgui-java-binding</artifactId>
|
||||
<version>${imgui.java.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.spair</groupId>
|
||||
<artifactId>imgui-java-lwjgl3</artifactId>
|
||||
<version>${imgui.java.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.spair</groupId>
|
||||
<artifactId>imgui-java-natives-windows</artifactId>
|
||||
<version>${imgui.java.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Raw Jars</b></summary>
|
||||
|
||||
1. Go to the [release page](https://github.com/SpaiR/imgui-java/releases/latest);
|
||||
2. Download `imgui-binding-${version}.jar`, `imgui-lwjgl3-${version}.jar` and binary libraries for your OS;
|
||||
- imgui-java64.dll - Windows
|
||||
- libimgui-java64.so - Linux
|
||||
- libimgui-java64.dylib - macOS
|
||||
3. Add jars to your classpath;
|
||||
4. Provide a VM option: `imgui.library.path` or `java.library.path`. It should point to the folder where you've placed downloaded native libraries.
|
||||
</details>
|
||||
|
||||
#### Java Module System
|
||||
If using Java 9 modules, imgui-java has Automatic Module Names:
|
||||
|
||||
| Package | Module |
|
||||
|----------------------------|-----------------------|
|
||||
| imgui-java-app | imgui.app |
|
||||
| imgui-java-binding | imgui.binding |
|
||||
| imgui-java-lwjgl3 | imgui.lwjgl3 |
|
||||
| imgui-java-natives-windows | imgui.natives.windows |
|
||||
| imgui-java-natives-linux | imgui.natives.linux |
|
||||
| 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>
|
||||
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>
|
||||
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>
|
||||
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>
|
||||
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>
|
||||
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.
|
||||
|
||||
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.
|
||||
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>
|
||||
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>
|
||||
|
||||
```
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
ext {
|
||||
lwjglVersion = '3.3.1'
|
||||
imguiVersion = '1.86.4'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
|
||||
|
||||
['', '-opengl', '-glfw'].each {
|
||||
implementation "org.lwjgl:lwjgl$it:$lwjglVersion"
|
||||
implementation "org.lwjgl:lwjgl$it::natives-windows"
|
||||
}
|
||||
|
||||
implementation "io.github.spair:imgui-java-binding:$imguiVersion"
|
||||
implementation "io.github.spair:imgui-java-lwjgl3:$imguiVersion"
|
||||
|
||||
// This is the main difference
|
||||
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.
|
||||
|
||||
| Native Binaries With FreeType | System |
|
||||
|-------------------------------|---------|
|
||||
| imgui-java-natives-windows-ft | Windows |
|
||||
| imgui-java-natives-linux-ft | Linux |
|
||||
| imgui-java-natives-macos-ft | macOS |
|
||||
|
||||
# Binding Notice
|
||||
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>
|
||||
By changing the pointer it's possible to use the same Java instance to work with different native structs.<br>
|
||||
Most of the time you can ignore this fact and just work with objects in a common way.
|
||||
|
||||
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
|
||||
* 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"`
|
||||
|
||||
### 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`
|
||||
|
||||
### 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>
|
||||
`-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
|
||||
[](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).
|
||||
Reference in new issue
Block a user