Skip to content

Commit a2444c6

Browse files
committed
[API] Add ImDrawList methods
Added: - PrimReserve - PrimUnreserve - PrimRect - PrimRectUV - PrimQuadUV - PrimWriteVtx - PrimVtx
1 parent 08bf84a commit a2444c6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,4 +457,36 @@ public void addText(final ImFont imFont, final float fontSize, final float posX,
457457
public native void channelsSetCurrent(int n); /*
458458
IM_DRAW_LIST->ChannelsSetCurrent(n);
459459
*/
460+
461+
// Advanced: Primitives allocations
462+
// - We render triangles (three vertices)
463+
// - All primitives needs to be reserved via PrimReserve() beforehand.
464+
465+
public native void primReserve(int idxCount, int vtxCount); /*
466+
IM_DRAW_LIST->PrimReserve(idxCount, vtxCount);
467+
*/
468+
469+
public native void primUnreserve(int idxCount, int vtxCount); /*
470+
IM_DRAW_LIST->PrimUnreserve(idxCount, vtxCount);
471+
*/
472+
473+
public native void primRect(float ax, float ay, float bx, float by, int col); /*
474+
IM_DRAW_LIST->PrimRect(ImVec2(ax, ay), ImVec2(bx, by), col);
475+
*/
476+
477+
public native void primRectUV(float ax, float ay, float bx, float by, float uvAx, float uvAy, float uvBx, float uvBy, int col); /*
478+
IM_DRAW_LIST->PrimRectUV(ImVec2(ax, ay), ImVec2(bx, by), ImVec2(uvAx, uvAy), ImVec2(uvBx, uvBy), col);
479+
*/
480+
481+
public native void primQuadUV(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, float uvAx, float uvAy, float uvBx, float uvBy, float uvCx, float uvCy, float uvDx, float uvDy, int col); /*
482+
IM_DRAW_LIST->PrimQuadUV(ImVec2(ax, ay), ImVec2(bx, by), ImVec2(cx, cy), ImVec2(dx, dy), ImVec2(uvAx, uvAy), ImVec2(uvBx, uvBy), ImVec2(uvCx, uvCy), ImVec2(uvDx, uvDy), col);
483+
*/
484+
485+
public native void primWriteVtx(float posX, float posY, float uvX, float uvY, int col); /*
486+
IM_DRAW_LIST->PrimWriteVtx(ImVec2(posX, posY), ImVec2(uvX, uvY), col);
487+
*/
488+
489+
public native void primVtx(float posX, float posY, float uvX, float uvY, int col); /*
490+
IM_DRAW_LIST->PrimVtx(ImVec2(posX, posY), ImVec2(uvX, uvY), col);
491+
*/
460492
}

0 commit comments

Comments
 (0)