feat(api): Dear ImGui v1.87 + ImPlot v0.13 (#252)
* build(deps): bump Dear ImGui from 1.86 to 1.87 * build(deps): bump implot from 0.12 to 0.13 * feat(api,binding): adapt API to Dear ImGui v1.87 * feat(api,binding): adapt API to implot v0.13 * build: generate API for latest changes * chore(binding): add missing super call for ImGuiStructDestroyable constructor * chore: minor code style * feat: adapt ImGuiImplGlfw to 1.87 * feat: adapt ImGuiImplGl3 to 1.87 * feat: adapt imgui-app module to 1.87 * fix: javadoc for updated imgui-binding * fix: loosing data when setting struct field of char* type Since we manually release chars, to store them in field we need to do a local copy. * fix: invalid methods to check program linking in OpenGL * chore: remove dedicated method to check GLFW version * fix: add missing include
This commit is contained in:
1 parent
341b0af179
commit
47d97102f7
80 files changed
+12211
-7373
No files matched your search
@@ -71,7 +71,7 @@ private fun convertParams2jni(f: Factory, params: List<CtParameter<*>>, defaults
|
||||
setType<Nothing>(f.createTypeParam("double"))
|
||||
setSimpleName<Nothing>("${p.simpleName}Max")
|
||||
}
|
||||
} else if (p.isType("ImPlotLimits")) {
|
||||
} else if (p.isType("ImPlotRect")) {
|
||||
result += f.createParameter<Nothing>().apply {
|
||||
setType<Nothing>(f.createTypeParam("double"))
|
||||
setSimpleName<Nothing>("${p.simpleName}MinX")
|
||||
@@ -155,8 +155,8 @@ private fun joinInBodyParams(params: List<CtParameter<*>>, defaults: IntArray):
|
||||
"ImPlotRange(${p.simpleName}Min, ${p.simpleName}Max)"
|
||||
}
|
||||
|
||||
"ImPlotLimits" -> {
|
||||
"ImPlotLimits(${p.simpleName}MinX, ${p.simpleName}MinY, ${p.simpleName}MaxX, ${p.simpleName}MaxY)"
|
||||
"ImPlotRect" -> {
|
||||
"ImPlotRect(${p.simpleName}MinX, ${p.simpleName}MinY, ${p.simpleName}MaxX, ${p.simpleName}MaxY)"
|
||||
}
|
||||
|
||||
"TextEditorCoordinates" -> {
|
||||
@@ -281,8 +281,10 @@ private fun createMethod(mOrig: CtMethod<*>, params: List<CtParameter<*>>, defau
|
||||
append(joinInBodyParams(params, defaults))
|
||||
append(')')
|
||||
|
||||
mOrig.getAnnotation(A_NAME_RETURN_VALUE)?.let { a ->
|
||||
append(a.getValueAsString(A_VALUE_CALL_SUFFIX))
|
||||
if (!mOrig.isType("void")) {
|
||||
mOrig.getAnnotation(A_NAME_RETURN_VALUE)?.let { a ->
|
||||
append(a.getValueAsString(A_VALUE_CALL_SUFFIX))
|
||||
}
|
||||
}
|
||||
|
||||
if (jniCpyReturn) {
|
||||
@@ -553,7 +555,7 @@ private fun createFieldGetContent(field: CtField<*>): List<String> {
|
||||
)
|
||||
}
|
||||
|
||||
"ImVec2", "ImVec4" -> {
|
||||
else -> {
|
||||
getArray.setBody<Nothing>(
|
||||
f.createCodeSnippet(
|
||||
"""
|
||||
@@ -602,6 +604,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
|
||||
setAccessor.setParent<Nothing>(field.parent)
|
||||
setAccessor.setSimpleName<Nothing>("set${field.simpleName}")
|
||||
setAccessor.addModifier<Nothing>(ModifierKind.PRIVATE)
|
||||
setAccessor.setAnnotations<Nothing>(field.annotations)
|
||||
|
||||
val valueParam = f.createParameter<Nothing>().apply {
|
||||
setType<Nothing>(field.type)
|
||||
@@ -633,7 +636,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
|
||||
)
|
||||
}
|
||||
|
||||
"ImVec2", "ImVec4" -> {
|
||||
else -> {
|
||||
setArray.setBody<Nothing>(
|
||||
f.createCodeSnippet("""
|
||||
Jni::${arrayType}ArrayCpy(env, value, $PTR_JNI_THIS->${field.getCallName()}, $arraySize)
|
||||
@@ -665,10 +668,16 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
|
||||
}
|
||||
} else {
|
||||
result += transformMethodToContent(setAccessor, listOf(valueParam)).map {
|
||||
it.replace(
|
||||
"$PTR_JNI_THIS->${setAccessor.simpleName}\\((.+)\\)".toRegex(),
|
||||
"$PTR_JNI_THIS->${field.getCallName()} = $1"
|
||||
)
|
||||
val fieldName = "$PTR_JNI_THIS->${field.getCallName()}"
|
||||
val replaceTarget = "$PTR_JNI_THIS->${setAccessor.simpleName}\\((.+)\\)"
|
||||
var replaceContent = "$fieldName = $1"
|
||||
|
||||
// When we set a string to a field we need to manually copy the string itself.
|
||||
if (field.isType("String") && !field.hasAnnotation(A_NAME_TYPE_STD_STRING)) {
|
||||
replaceContent = "SET_STRING_FIELD($fieldName, $1)"
|
||||
}
|
||||
|
||||
it.replace(replaceTarget.toRegex(), replaceContent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ private fun joinInBodyParams(params: List<CtParameter<*>>, defaults: IntArray):
|
||||
|
||||
"ImPlotPoint" -> "${p.simpleName}.x, ${p.simpleName}.y"
|
||||
"ImPlotRange" -> "${p.simpleName}.min, ${p.simpleName}.max"
|
||||
"ImPlotLimits" -> "${p.simpleName}.x.min, ${p.simpleName}.y.min, ${p.simpleName}.x.max, ${p.simpleName}.y.max"
|
||||
"ImPlotRect" -> "${p.simpleName}.x.min, ${p.simpleName}.y.min, ${p.simpleName}.x.max, ${p.simpleName}.y.max"
|
||||
|
||||
"TextEditorCoordinates" -> "${p.simpleName}.mLine, ${p.simpleName}.mColumn"
|
||||
|
||||
@@ -366,7 +366,7 @@ private fun methodPlotLimitsUnwrappedContent(method: CtMethod<*>): String {
|
||||
val paramNames = mutableSetOf<String>()
|
||||
|
||||
for (p in newMethod.parameters) {
|
||||
if (p.isType("ImPlotLimits")) {
|
||||
if (p.isType("ImPlotRect")) {
|
||||
paramNames += p.simpleName
|
||||
|
||||
val paramMinX = p.factory.createParameter<Nothing>()
|
||||
@@ -527,7 +527,7 @@ private fun transformMethodToContent(
|
||||
methodPlotRangeUnwrappedContent(mNew).takeIf(String::isNotEmpty)?.run(methods::add)
|
||||
}
|
||||
|
||||
if (params.find { it.isType("ImPlotLimits") } != null) {
|
||||
if (params.find { it.isType("ImPlotRect") } != null) {
|
||||
methodPlotLimitsUnwrappedContent(mNew).takeIf(String::isNotEmpty)?.run(methods::add)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ const val A_NAME_EXCLUDED_SOURCE = "ExcludedSource"
|
||||
const val A_NAME_RETURN_VALUE = "ReturnValue"
|
||||
const val A_NAME_ARG_VALUE = "ArgValue"
|
||||
const val A_NAME_TYPE_ARRAY = "TypeArray"
|
||||
const val A_NAME_TYPE_STD_STRING = "TypeStdString"
|
||||
|
||||
const val A_VALUE_CALL_PTR = "callPtr"
|
||||
const val A_VALUE_CALL_OPERATOR = "callOperator"
|
||||
@@ -55,6 +56,7 @@ val CLEANUP_ANNOTATIONS_LIST = listOf(
|
||||
A_NAME_OPT_ARG,
|
||||
A_NAME_ARG_VALUE,
|
||||
A_NAME_TYPE_ARRAY,
|
||||
A_NAME_TYPE_STD_STRING,
|
||||
A_NAME_BINDING_AST_ENUM,
|
||||
)
|
||||
|
||||
@@ -74,7 +76,7 @@ val DST_RETURN_TYPE_SET = setOf(
|
||||
"ImRect",
|
||||
"ImPlotPoint",
|
||||
"ImPlotRange",
|
||||
"ImPlotLimits",
|
||||
"ImPlotRect",
|
||||
"TextEditorCoordinates",
|
||||
)
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user