fix: return methods lost during integration of binding generation API

This commit is contained in:
SpaiR committed 2024-08-19 14:34:02 +03:00
1 parent 9fbffddbd9
commit 8f76b2083f
3 files changed
+80 -8

No files matched your search

@@ -540,7 +540,7 @@ private fun createFieldGetContent(field: CtField<*>): List<String> {
getArray.setType<Nothing>(f.createTypeParam("$arrayType[]"))
when (arrayType) {
"boolean", "short", "int", "float", "double", "long" -> {
"boolean", "byte", "short", "int", "float", "double", "long" -> {
getArray.setBody<Nothing>(
f.createCodeSnippet(
"""
@@ -569,7 +569,7 @@ private fun createFieldGetContent(field: CtField<*>): List<String> {
result += getArray.prettyprint(false)
when (arrayType) {
"boolean", "short", "int", "float", "double", "long" -> {
"boolean", "byte", "short", "int", "float", "double", "long" -> {
val getArrayIdx = getArray.clone()
getArrayIdx.addParameter<Nothing>(f.createParameter<Nothing>().apply {
setType<Nothing>(f.createTypeParam("int"))
@@ -625,7 +625,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
setArray.setSimpleName<Nothing>("nSet${field.simpleName}")
when (arrayType) {
"boolean", "short", "int", "float", "double", "long" -> {
"boolean", "byte", "short", "int", "float", "double", "long" -> {
setArray.setBody<Nothing>(
f.createCodeSnippet(
"""
@@ -649,7 +649,7 @@ private fun createFieldSetContent(field: CtField<*>): List<String> {
result += setArray.prettyprint(false)
when (arrayType) {
"boolean", "short", "int", "float", "double", "long" -> {
"boolean", "byte", "short", "int", "float", "double", "long" -> {
val setArrayIdx = setArray.clone()
setArrayIdx.parameters.clear()
setArrayIdx.addParameter<Nothing>(f.createParameter<Nothing>().apply {
@@ -27,7 +27,22 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
return (intptr_t)cfg;
*/
// TODO: FontData
/**
* TTF/OTF data
*/
public native byte[] getFontData(); /*
int size = THIS->FontDataSize;
jbyteArray jBuf = env->NewByteArray(size);
env->SetByteArrayRegion(jBuf, 0, size, (jbyte*)THIS->FontData);
return jBuf;
*/
/**
* TTF/OTF data
*/
public native void setFontData(byte[] fontData); /*
THIS->FontData = &fontData[0];
*/
/**
* TTF/OTF data size
@@ -313,7 +328,28 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
THIS->GlyphOffset = value;
*/
// TODO: GlyphRanges
private short[] glyphRanges;
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public short[] getGlyphRanges() {
return glyphRanges;
}
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public void setGlyphRanges(final short[] glyphRanges) {
this.glyphRanges = glyphRanges;
nSetGlyphRanges(glyphRanges);
}
private native void nSetGlyphRanges(short[] glyphRanges); /*
THIS->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL;
*/
/**
* Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
@@ -30,7 +30,22 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
return (intptr_t)cfg;
*/
// TODO: FontData
/**
* TTF/OTF data
*/
public native byte[] getFontData(); /*
int size = THIS->FontDataSize;
jbyteArray jBuf = env->NewByteArray(size);
env->SetByteArrayRegion(jBuf, 0, size, (jbyte*)THIS->FontData);
return jBuf;
*/
/**
* TTF/OTF data
*/
public native void setFontData(byte[] fontData); /*
THIS->FontData = &fontData[0];
*/
/**
* TTF/OTF data size
@@ -90,7 +105,28 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
@BindingField
public ImVec2 GlyphOffset;
// TODO: GlyphRanges
private short[] glyphRanges;
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public short[] getGlyphRanges() {
return glyphRanges;
}
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public void setGlyphRanges(final short[] glyphRanges) {
this.glyphRanges = glyphRanges;
nSetGlyphRanges(glyphRanges);
}
private native void nSetGlyphRanges(short[] glyphRanges); /*
THIS->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL;
*/
/**
* Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font