Skip to content

Commit 08bf84a

Browse files
committed
[API] Dear ImGui v1.81
1 parent ec9226c commit 08bf84a

File tree

10 files changed

+262
-379
lines changed

10 files changed

+262
-379
lines changed

buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GenerateLibs extends DefaultTask {
1818
private final boolean forMac64 = buildEnvs?.contains('mac64')
1919

2020
private final boolean isLocal = System.properties.containsKey("local")
21-
private final boolean withFreeType = System.properties.containsKey("withFreeType")
21+
private final boolean withFreeType = System.properties.containsKey("freetype")
2222

2323
private final String sourceDir = project.file('src/main/java')
2424
private final String classpath = project.file('build/classes/java/main')
@@ -42,16 +42,17 @@ class GenerateLibs extends DefaultTask {
4242
['include/imgui', 'include/imnodes', 'include/imgui-node-editor'].each {
4343
spec.from(project.rootProject.file(it)) { CopySpec s -> s.include('*.h', '*.cpp', '*.inl') }
4444
}
45+
spec.from(project.rootProject.file('imgui-binding/src/main/native'))
46+
spec.into(jniDir)
47+
}
4548

46-
if (withFreeType) {
49+
if (withFreeType) {
50+
project.copy { CopySpec spec ->
4751
spec.from(project.rootProject.file('include/imgui/misc/freetype')) { CopySpec it -> it.include('*.h', '*.cpp') }
52+
spec.into("$jniDir/misc/freetype")
4853
}
4954

50-
spec.into(jniDir)
51-
}
52-
53-
project.copy {CopySpec spec ->
54-
spec.from(project.rootProject.file('imgui-binding/src/main/native')).into(jniDir)
55+
enableDefine('IMGUI_ENABLE_FREETYPE')
5556
}
5657

5758
// Generate platform dependant ant configs and header files
@@ -104,8 +105,8 @@ class GenerateLibs extends DefaultTask {
104105
def minMacOsVersion = '10.15'
105106
def mac64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, true)
106107
mac64.cppFlags += ' -std=c++14 -stdlib=libc++'
107-
mac64.cppFlags = mac64.cppFlags.replace('10.5', minMacOsVersion).replace('10.7', minMacOsVersion)
108-
mac64.linkerFlags = mac64.linkerFlags.replace('10.5', minMacOsVersion).replace('10.7', minMacOsVersion)
108+
mac64.cppFlags = mac64.cppFlags.replace('10.7', minMacOsVersion)
109+
mac64.linkerFlags = mac64.linkerFlags.replace('10.7', minMacOsVersion)
109110

110111
if (withFreeType) {
111112
mac64.cppFlags += ' -I/usr/local/include/freetype2 -I/usr/local/include/libpng16 -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include'
@@ -117,12 +118,6 @@ class GenerateLibs extends DefaultTask {
117118

118119
new AntScriptGenerator().generate(buildConfig, buildTargets)
119120

120-
if (!withFreeType) {
121-
project.delete {
122-
it.delete("$jniDir/imgui_ImGuiFreeType.cpp", "$jniDir/imgui_ImGuiFreeType.h")
123-
}
124-
}
125-
126121
// Generate native libraries
127122
// Comment/uncomment lines with OS you need.
128123

@@ -139,4 +134,8 @@ class GenerateLibs extends DefaultTask {
139134

140135
BuildExecutor.executeAnt(jniDir + '/build.xml', '-v', 'pack-natives')
141136
}
137+
138+
void enableDefine(String define) {
139+
project.file("$jniDir/imconfig.h").text += "#define $define"
140+
}
142141
}

imgui-binding/src/main/java/imgui/ImFontConfig.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ protected long create() {
116116

117117
/**
118118
* Rasterize at higher quality for sub-pixel positioning.
119+
* Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory.
119120
* Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
120121
*/
121122
public native int getOversampleH(); /*
@@ -124,6 +125,7 @@ protected long create() {
124125

125126
/**
126127
* Rasterize at higher quality for sub-pixel positioning.
128+
* Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory.
127129
* Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
128130
*/
129131
public native void setOversampleH(int oversampleH); /*
@@ -132,15 +134,15 @@ protected long create() {
132134

133135
/**
134136
* Rasterize at higher quality for sub-pixel positioning.
135-
* We don't use sub-pixel positions on the Y axis.
137+
* This is not really useful as we don't use sub-pixel positions on the Y axis.
136138
*/
137139
public native int getOversampleV(); /*
138140
return IM_FONT_CONFIG->OversampleV;
139141
*/
140142

141143
/**
142144
* Rasterize at higher quality for sub-pixel positioning.
143-
* We don't use sub-pixel positions on the Y axis.
145+
* This is not really useful as we don't use sub-pixel positions on the Y axis.
144146
*/
145147
public native void setOversampleV(int oversampleV); /*
146148
IM_FONT_CONFIG->OversampleV = oversampleV;
@@ -286,17 +288,17 @@ public void setGlyphRanges(final short[] glyphRanges) {
286288
*/
287289

288290
/**
289-
* Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one.
291+
* Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
290292
*/
291-
public native int getRasterizerFlags(); /*
292-
return IM_FONT_CONFIG->RasterizerFlags;
293+
public native int getFontBuilderFlags(); /*
294+
return IM_FONT_CONFIG->FontBuilderFlags;
293295
*/
294296

295297
/**
296-
* Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one.
298+
* Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
297299
*/
298-
public native void setRasterizerFlags(int rasterizerFlags); /*
299-
IM_FONT_CONFIG->RasterizerFlags = (unsigned int)rasterizerFlags;
300+
public native void setFontBuilderFlags(int fontBuilderFlags); /*
301+
IM_FONT_CONFIG->FontBuilderFlags = (unsigned int)fontBuilderFlags;
300302
*/
301303

302304
/**

imgui-binding/src/main/java/imgui/ImFontGlyph.java

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,47 @@ protected long create() {
3232
*/
3333

3434
/**
35-
* 0x0000..0xFFFF
35+
* Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops).
3636
*/
37-
public native int getCodepoint(); /*
38-
return (unsigned int)IM_FONT_GLYPH->Codepoint;
37+
public native int getColored(); /*
38+
return (unsigned int)IM_FONT_GLYPH->Colored;
3939
*/
4040

4141
/**
42-
* 0x0000..0xFFFF
42+
* Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops).
4343
*/
44-
public native void setCodepoint(int codepoint); /*
45-
IM_FONT_GLYPH->Codepoint = (unsigned int)codepoint;
44+
public native void setColored(int colored); /*
45+
IM_FONT_GLYPH->Colored = (unsigned int)colored;
4646
*/
4747

4848
/**
49-
* Flag to allow early out when rendering
49+
* Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.
5050
*/
5151
public native int getVisible(); /*
5252
return (unsigned int)IM_FONT_GLYPH->Visible;
5353
*/
5454

5555
/**
56-
* Flag to allow early out when rendering
56+
* Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.
5757
*/
5858
public native void setVisible(int visible); /*
5959
IM_FONT_GLYPH->Visible = (unsigned int)visible;
6060
*/
6161

62+
/**
63+
* 0x0000..0xFFFF
64+
*/
65+
public native int getCodepoint(); /*
66+
return (unsigned int)IM_FONT_GLYPH->Codepoint;
67+
*/
68+
69+
/**
70+
* 0x0000..0xFFFF
71+
*/
72+
public native void setCodepoint(int codepoint); /*
73+
IM_FONT_GLYPH->Codepoint = (unsigned int)codepoint;
74+
*/
75+
6276
/**
6377
* Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)
6478
*/

0 commit comments

Comments
 (0)