Refactor mapping to the native structs

This commit is contained in:
SpaiR committed 2020-08-23 16:49:16 +03:00
1 parent 1209caa518
commit 1dcf2328a4
17 files changed
+194 -251

No files matched your search

@@ -1,5 +1,7 @@
package imgui;
import imgui.binding.ImGuiStruct;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -11,36 +13,28 @@ import java.nio.ByteOrder;
* BINDING NOTICE: Since it's impossible to do a 1:1 mapping with JNI, current class provides "getCmdList*()" methods.
* Those are used to get the data needed to do a rendering.
*/
public final class ImDrawData {
public final class ImDrawData extends ImGuiStruct {
public static final int SIZEOF_IM_DRAW_IDX = 2;
public static final int SIZEOF_IM_DRAW_VERT = (4 + 1) * 4;
private static final int FACTOR = 5_000;
final long ptr;
private ByteBuffer idxBuffer = ByteBuffer.allocateDirect(SIZEOF_IM_DRAW_IDX * FACTOR).order(ByteOrder.nativeOrder());
private ByteBuffer vtxBuffer = ByteBuffer.allocateDirect(SIZEOF_IM_DRAW_VERT * FACTOR).order(ByteOrder.nativeOrder());
ImDrawData(final long ptr) {
this.ptr = ptr;
public ImDrawData(final long ptr) {
super(ptr);
}
/*JNI
#include <stdint.h>
#include <imgui.h>
#include "jni_common.h"
#include "jni_binding_struct.h"
jfieldID imDrawDataPtrID;
#define IM_DRAW_DATA ((ImDrawData*)env->GetLongField(object, imDrawDataPtrID))
#define IM_DRAW_DATA ((ImDrawData*)STRUCT_PTR)
*/
static native void nInit(); /*
jclass jImDrawDataClass = env->FindClass("imgui/ImDrawData");
imDrawDataPtrID = env->GetFieldID(jImDrawDataClass, "ptr", "J");
*/
///////// Start of Render Methods | Binding
/**