Skip to content

Commit 8e604fd

Browse files
committed
Add ImDrawData helper methods to get ImVec2 values
1 parent fc8f0b0 commit 8e604fd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,20 @@ public ByteBuffer getCmdListVtxBufferData(final int cmdListIdx) {
184184
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplayPos, dstImVec2);
185185
*/
186186

187+
/**
188+
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
189+
*/
190+
public native float getDisplayPosX(); /*
191+
return IM_DRAW_DATA->DisplayPos.x;
192+
*/
193+
194+
/**
195+
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
196+
*/
197+
public native float getDisplayPosY(); /*
198+
return IM_DRAW_DATA->DisplayPos.y;
199+
*/
200+
187201
/**
188202
* Size of the viewport to render (== io.DisplaySize for the main viewport)
189203
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
@@ -192,13 +206,43 @@ public ByteBuffer getCmdListVtxBufferData(final int cmdListIdx) {
192206
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplaySize, dstImVec2);
193207
*/
194208

209+
/**
210+
* Size of the viewport to render (== io.DisplaySize for the main viewport)
211+
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
212+
*/
213+
public native float getDisplaySizeX(); /*
214+
return IM_DRAW_DATA->DisplaySize.x;
215+
*/
216+
217+
/**
218+
* Size of the viewport to render (== io.DisplaySize for the main viewport)
219+
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
220+
*/
221+
public native float getDisplaySizeY(); /*
222+
return IM_DRAW_DATA->DisplaySize.y;
223+
*/
224+
195225
/**
196226
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
197227
*/
198228
public native void getFramebufferScale(ImVec2 dstImVec2); /*
199229
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->FramebufferScale, dstImVec2);
200230
*/
201231

232+
/**
233+
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
234+
*/
235+
public native float getFramebufferScaleX(); /*
236+
return IM_DRAW_DATA->FramebufferScale.x;
237+
*/
238+
239+
/**
240+
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
241+
*/
242+
public native float getFramebufferScaleY(); /*
243+
return IM_DRAW_DATA->FramebufferScale.y;
244+
*/
245+
202246
// Functions
203247

204248
/**

0 commit comments

Comments
 (0)