Skip to content

Commit 06fd8ac

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # build.gradle
2 parents 35b83a7 + 5409397 commit 06fd8ac

File tree

149 files changed

+6354
-3495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+6354
-3495
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
language: java
2+
jdk: openjdk11

README.md

Lines changed: 26 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -108,82 +108,27 @@ Dear ImGui allows you create elaborate tools as well as very short-lived ones. O
108108

109109
### Demo
110110

111-
You should be able to try the examples from `test` (tested on Windows/Mac/Linux) within seconds: clone, sync and run. If you don't, let me know!
111+
You should be able to try the examples from `test` (tested on Windows/Mac/Linux) within minutes. If you don't, let me know!
112112

113-
Kotlin:
113+
OpenGL Kotlin:
114114

115-
- [OpenGL3](src/test/kotlin/imgui/opengl3.kt)
116-
- [OpenGL2](src/test/kotlin/imgui/opengl2.kt)
117-
- [Vulkan](src/test/kotlin/imgui/vulkan.kt) (broken, to fix, but still valuable for the moment)
115+
- [lwjgl](src/test/kotlin/imgui/gl/test%20lwjgl.kt)
116+
- [jogl](src/test/kotlin/imgui/gl/test%20jogl.kt)
118117

119-
- [jogl-GL3](src/test/kotlin/imgui/gl/test%20jogl.kt) (not mantained anymore ufficially but keeping dormant in case something comes up)
118+
OpenGL Java:
120119

121-
Java:
120+
- [lwjgl](src/test/java/imgui/gl/Test_lwjgl.java)
122121

123-
- [OpenGL3](src/test/java/imgui/OpenGL3.java)
122+
Vulkan Kotlin:
124123

125-
Note:
126-
- we tend to avoid nullability, whenever Omar uses `NULL` with the string endings, we passes `-1` instead.
127-
- `DEBUG = false` (`import static imgui.ImguiKt.setDEBUG;` for Java users) to turn off `println()` debugs
124+
- [lwjgl](src/test/kotlin/imgui/vk/test%20lwjgl%20vk.kt) (broken, to fix)
128125

129-
You should refer to those also to learn how to use the imgui library.
130-
131-
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness you can load/reload your font at different scale, and scale your Style with `style.scaleAllSizes()`.
132-
133-
### Functional Programming / Domain Specific Language
134-
135-
All the functions are ported exactly as the original. Moreover in order to take advantage of Functional Programming
136-
this port offers some comfortable constructs, giving the luxury to forget about some annoying and very error prone
137-
burden code such as the ending `*Pop()`, `*end()` and so on.
138126

139-
These constucts shine especially in Kotlin, where they are also inlined.
140-
141-
Let's take an original cpp sample and let's see how we can make it nicer:
142-
```cpp
143-
if (ImGui::TreeNode("Querying Status (Active/Focused/Hovered etc.)")) {
144-
ImGui::Checkbox("Hovered/Active tests after Begin() for title bar testing", &test_window);
145-
if (test_window) {
146-
ImGui::Begin("Title bar Hovered/Active tests", &test_window);
147-
if (ImGui::BeginPopupContextItem()) // <-- This is using IsItemHovered() {
148-
if (ImGui::MenuItem("Close")) { test_window = false; }
149-
ImGui::EndPopup();
150-
}
151-
ImGui::Text("whatever\n");
152-
ImGui::End();
153-
}
154-
ImGui::TreePop();
155-
}
156-
```
157-
This may become in Kotlin:
158-
```kotlin
159-
treeNode("Querying Status (Active/Focused/Hovered etc.)") {
160-
checkbox("Hovered/Active tests after Begin() for title bar testing", ::test_window)
161-
if (test_window)
162-
window ("Title bar Hovered/Active tests", ::test_window) {
163-
popupContextItem { // <-- This is using IsItemHovered() {
164-
menuItem("Close") { test_window = false }
165-
}
166-
text("whatever\n")
167-
}
168-
}
169-
```
170-
Or in Java:
171-
```java
172-
treeNode("Querying Status (Active/Focused/Hovered etc.)", () -> {
173-
checkbox("Hovered/Active tests after Begin() for title bar testing", test_window)
174-
if (test_window[0])
175-
window ("Title bar Hovered/Active tests", test_window, () -> {
176-
popupContextItem(() -> { // <-- This is using IsItemHovered() {
177-
menuItem("Close", () -> test_window = false);
178-
});
179-
text("whatever\n");
180-
});
181-
});
182-
```
127+
You should refer to those also to learn how to use the imgui library.
183128

184-
The demo mixes some traditional imgui-calls with these DSL calls.
129+
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
185130

186-
Refer to the corresponding [`dsl`](src/main/kotlin/imgui/dsl.kt) object for Kotlin or [`dsl_`](src/main/java/imgui/dsl_.java) class for Java.
131+
Ps: `DEBUG = false` to turn off debugs `println()`
187132

188133
### Native Roadmap
189134

@@ -217,7 +162,21 @@ repositories {
217162
}
218163
219164
dependencies {
220-
compile 'com.github.kotlin-graphics:imgui:-SNAPSHOT'
165+
/*
166+
Each renderer will need different dependencies.
167+
Each one needs core.
168+
OpenGL needs "gl", "glfw"
169+
Vulkan needs "vk", "glfw"
170+
JOGL needs "jogl"
171+
OpenJFX needs "openjfx"
172+
173+
To get all the dependencies in one sweep, create an array of the strings needed and loop through them like below.
174+
Any number of renderers can be added to the project like this however, you could all all of them with the array ["gl", "glfw", "core", "vk", "jogl", "openjfx"]
175+
This example gets the OpenGL needed modules.
176+
*/
177+
["gl", "glfw", "core"].each {
178+
implementation "com.github.kotlin-graphics.imgui:imgui-$it:-SNAPSHOT"
179+
}
221180
222181
switch ( OperatingSystem.current() ) {
223182
case OperatingSystem.WINDOWS:

build.gradle

Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,69 +19,27 @@ ext{
1919
lwjgl_natives = current() == WINDOWS ? "windows" : current() == LINUX ? "linux" : "macos"
2020
}
2121

22-
dependencies {
23-
24-
implementation "$kotlin-stdlib"
22+
sourceCompatibility = 1.8
2523

26-
implementation 'com.github.kotlin-graphics:uno-sdk:ae2f5a51953f78c71f0a6a052037f6e399e80937'
24+
dependencies {
25+
implementation "$kotlin-stdlib-jdk8"
2726

2827
testImplementation "io.kotlintest:kotlintest-runner-junit5:$kotlintest_version".toString()
2928

30-
def joglVersion = '2.3.2'
31-
implementation "org.jogamp.gluegen:gluegen-rt-main:$joglVersion"
32-
implementation "org.jogamp.jogl:jogl-all-main:$joglVersion"
33-
34-
["", "-glfw", "-jemalloc", "-opengl", "-stb", "-remotery", "-bgfx"].each {
35-
String base = "org.lwjgl:lwjgl$it:$lwjgl_version"
36-
implementation base
37-
testRuntime "$base:natives-$lwjgl_natives"
38-
shadow "$base:natives-$lwjgl_natives"
39-
}
40-
4129
compile files("${System.properties['java.home']}/../lib/tools.jar") // for debug, classes instances
4230
}
4331

44-
repositories {
45-
mavenCentral()
46-
maven { setUrl("https://oss.sonatype.org/content/repositories/snapshots/") }
47-
maven { url 'https://jitpack.io' }
48-
}
49-
50-
task lightJar(type: Jar) {
51-
classifier = 'light'
52-
from sourceSets.main.output
53-
exclude 'extraFonts'
54-
inputs.property("moduleName", moduleName)
55-
manifest {
56-
attributes('Automatic-Module-Name': moduleName)
32+
allprojects {
33+
repositories {
34+
mavenCentral()
35+
maven { setUrl("https://oss.sonatype.org/content/repositories/snapshots/") }
36+
maven { url 'https://jitpack.io' }
5737
}
5838
}
5939

60-
task sourcesJar(type: Jar, dependsOn: classes) {
61-
archiveClassifier = 'sources'
62-
from sourceSets.main.allSource
40+
compileKotlin {
41+
kotlinOptions.jvmTarget = "1.8"
6342
}
64-
65-
task javadocJar(type: Jar, dependsOn: javadoc) {
66-
archiveClassifier = 'javadoc'
67-
from javadoc.destinationDir
68-
}
69-
70-
artifacts {
71-
archives lightJar
72-
archives sourcesJar
73-
archives javadocJar
74-
}
75-
76-
shadowJar {
77-
exclude 'module-info.class'
78-
inputs.property("moduleName", moduleName)
79-
manifest.attributes('Automatic-Module-Name': moduleName)
80-
}
81-
82-
jar {
83-
inputs.property("moduleName", moduleName)
84-
manifest.attributes('Automatic-Module-Name': moduleName)
85-
}
86-
87-
shadowJar.archiveClassifier = 'all'
43+
compileTestKotlin {
44+
kotlinOptions.jvmTarget = "1.8"
45+
}

gradle/wrapper/gradle-wrapper.jar

-370 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Oct 27 11:31:55 CEST 2017
1+
#Tue Apr 16 10:43:51 CDT 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

imgui-core/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id 'maven'
3+
id 'java'
4+
id "org.jetbrains.kotlin.jvm"
5+
id "com.github.johnrengelman.shadow"
6+
}
7+
8+
group 'com.github.kotlin-graphics'
9+
10+
sourceCompatibility = 1.8
11+
12+
ext.moduleName = 'com.github.kotlin_graphics.imgui_core'
13+
14+
dependencies {
15+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
16+
implementation 'com.github.kotlin-graphics:uno-sdk:ae2f5a51953f78c71f0a6a052037f6e399e80937'
17+
18+
["", "-jemalloc", "-stb"].each {
19+
String base = "org.lwjgl:lwjgl$it:$lwjgl_version"
20+
implementation base
21+
testRuntime "$base:natives-$lwjgl_natives"
22+
shadow "$base:natives-$lwjgl_natives"
23+
}
24+
testCompile group: 'junit', name: 'junit', version: '4.12'
25+
}
26+
27+
compileKotlin {
28+
kotlinOptions.jvmTarget = "1.8"
29+
}
30+
compileTestKotlin {
31+
kotlinOptions.jvmTarget = "1.8"
32+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)