|
| 1 | +package imgui; |
| 2 | + |
| 3 | +import imgui.binding.ImGuiStructDestroyable; |
| 4 | + |
| 5 | +/** |
| 6 | + * |
| 7 | + * // See ImFontAtlas::AddCustomRectXXX functions. |
| 8 | + * struct ImFontAtlasCustomRect |
| 9 | + * { |
| 10 | + * unsigned short Width, Height; // Input // Desired rectangle dimension |
| 11 | + * unsigned short X, Y; // Output // Packed position in Atlas |
| 12 | + * unsigned int GlyphID; // Input // For custom font glyphs only (ID < 0x110000) |
| 13 | + * float GlyphAdvanceX; // Input // For custom font glyphs only: glyph xadvance |
| 14 | + * ImVec2 GlyphOffset; // Input // For custom font glyphs only: glyph display offset |
| 15 | + * ImFont* Font; // Input // For custom font glyphs only: target font |
| 16 | + * ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } |
| 17 | + * bool IsPacked() const { return X != 0xFFFF; } |
| 18 | + }; |
| 19 | + */ |
| 20 | +public final class ImFontAtlasCustomRect extends ImGuiStructDestroyable { |
| 21 | + public ImFontAtlasCustomRect() { |
| 22 | + super(); |
| 23 | + } |
| 24 | + |
| 25 | + public ImFontAtlasCustomRect(final long ptr) { |
| 26 | + super(ptr); |
| 27 | + } |
| 28 | + |
| 29 | + @Override |
| 30 | + protected long create() { |
| 31 | + return nCreate(); |
| 32 | + } |
| 33 | + |
| 34 | + /*JNI |
| 35 | + #include "_common.h" |
| 36 | + #define THIS ((ImFontAtlasCustomRect*)STRUCT_PTR) |
| 37 | + */ |
| 38 | + |
| 39 | + private native long nCreate(); /* |
| 40 | + return (uintptr_t)(new ImFontAtlasCustomRect()); |
| 41 | + */ |
| 42 | + |
| 43 | + /** |
| 44 | + * Desired rectangle dimension |
| 45 | + */ |
| 46 | + public short getWidth() { |
| 47 | + return nGetWidth(); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Desired rectangle dimension |
| 52 | + */ |
| 53 | + public void setWidth(final short value) { |
| 54 | + nSetWidth(value); |
| 55 | + } |
| 56 | + |
| 57 | + private native short nGetWidth(); /* |
| 58 | + return THIS->Width; |
| 59 | + */ |
| 60 | + |
| 61 | + private native void nSetWidth(short value); /* |
| 62 | + THIS->Width = value; |
| 63 | + */ |
| 64 | + |
| 65 | + /** |
| 66 | + * Desired rectangle dimension |
| 67 | + */ |
| 68 | + public short getHeight() { |
| 69 | + return nGetHeight(); |
| 70 | + } |
| 71 | + |
| 72 | + /** |
| 73 | + * Desired rectangle dimension |
| 74 | + */ |
| 75 | + public void setHeight(final short value) { |
| 76 | + nSetHeight(value); |
| 77 | + } |
| 78 | + |
| 79 | + private native short nGetHeight(); /* |
| 80 | + return THIS->Height; |
| 81 | + */ |
| 82 | + |
| 83 | + private native void nSetHeight(short value); /* |
| 84 | + THIS->Height = value; |
| 85 | + */ |
| 86 | + |
| 87 | + /** |
| 88 | + * Packed position in Atlas |
| 89 | + */ |
| 90 | + public short getX() { |
| 91 | + return nGetX(); |
| 92 | + } |
| 93 | + |
| 94 | + private native short nGetX(); /* |
| 95 | + return THIS->X; |
| 96 | + */ |
| 97 | + |
| 98 | + /** |
| 99 | + * Packed position in Atlas |
| 100 | + */ |
| 101 | + public short getY() { |
| 102 | + return nGetY(); |
| 103 | + } |
| 104 | + |
| 105 | + private native short nGetY(); /* |
| 106 | + return THIS->Y; |
| 107 | + */ |
| 108 | + |
| 109 | + /** |
| 110 | + * For custom font glyphs only (ID < 0x110000) |
| 111 | + */ |
| 112 | + public int getGlyphID() { |
| 113 | + return nGetGlyphID(); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * For custom font glyphs only (ID < 0x110000) |
| 118 | + */ |
| 119 | + public void setGlyphID(final int value) { |
| 120 | + nSetGlyphID(value); |
| 121 | + } |
| 122 | + |
| 123 | + private native int nGetGlyphID(); /* |
| 124 | + return THIS->GlyphID; |
| 125 | + */ |
| 126 | + |
| 127 | + private native void nSetGlyphID(int value); /* |
| 128 | + THIS->GlyphID = value; |
| 129 | + */ |
| 130 | + |
| 131 | + /** |
| 132 | + * For custom font glyphs only: glyph xadvance |
| 133 | + */ |
| 134 | + public float getGlyphAdvanceX() { |
| 135 | + return nGetGlyphAdvanceX(); |
| 136 | + } |
| 137 | + |
| 138 | + /** |
| 139 | + * For custom font glyphs only: glyph xadvance |
| 140 | + */ |
| 141 | + public void setGlyphAdvanceX(final float value) { |
| 142 | + nSetGlyphAdvanceX(value); |
| 143 | + } |
| 144 | + |
| 145 | + private native float nGetGlyphAdvanceX(); /* |
| 146 | + return THIS->GlyphAdvanceX; |
| 147 | + */ |
| 148 | + |
| 149 | + private native void nSetGlyphAdvanceX(float value); /* |
| 150 | + THIS->GlyphAdvanceX = value; |
| 151 | + */ |
| 152 | + |
| 153 | + /** |
| 154 | + * For custom font glyphs only: glyph display offset |
| 155 | + */ |
| 156 | + public ImVec2 getGlyphOffset() { |
| 157 | + final ImVec2 dst = new ImVec2(); |
| 158 | + nGetGlyphOffset(dst); |
| 159 | + return dst; |
| 160 | + } |
| 161 | + |
| 162 | + /** |
| 163 | + * For custom font glyphs only: glyph display offset |
| 164 | + */ |
| 165 | + public float getGlyphOffsetX() { |
| 166 | + return nGetGlyphOffsetX(); |
| 167 | + } |
| 168 | + |
| 169 | + /** |
| 170 | + * For custom font glyphs only: glyph display offset |
| 171 | + */ |
| 172 | + public float getGlyphOffsetY() { |
| 173 | + return nGetGlyphOffsetY(); |
| 174 | + } |
| 175 | + |
| 176 | + /** |
| 177 | + * For custom font glyphs only: glyph display offset |
| 178 | + */ |
| 179 | + public void getGlyphOffset(final ImVec2 dst) { |
| 180 | + nGetGlyphOffset(dst); |
| 181 | + } |
| 182 | + |
| 183 | + /** |
| 184 | + * For custom font glyphs only: glyph display offset |
| 185 | + */ |
| 186 | + public void setGlyphOffset(final ImVec2 value) { |
| 187 | + nSetGlyphOffset(value.x, value.y); |
| 188 | + } |
| 189 | + |
| 190 | + /** |
| 191 | + * For custom font glyphs only: glyph display offset |
| 192 | + */ |
| 193 | + public void setGlyphOffset(final float valueX, final float valueY) { |
| 194 | + nSetGlyphOffset(valueX, valueY); |
| 195 | + } |
| 196 | + |
| 197 | + private native void nGetGlyphOffset(ImVec2 dst); /* |
| 198 | + Jni::ImVec2Cpy(env, THIS->GlyphOffset, dst); |
| 199 | + */ |
| 200 | + |
| 201 | + private native float nGetGlyphOffsetX(); /* |
| 202 | + return THIS->GlyphOffset.x; |
| 203 | + */ |
| 204 | + |
| 205 | + private native float nGetGlyphOffsetY(); /* |
| 206 | + return THIS->GlyphOffset.y; |
| 207 | + */ |
| 208 | + |
| 209 | + private native void nSetGlyphOffset(float valueX, float valueY); /*MANUAL |
| 210 | + ImVec2 value = ImVec2(valueX, valueY); |
| 211 | + THIS->GlyphOffset = value; |
| 212 | + */ |
| 213 | + |
| 214 | + /** |
| 215 | + * For custom font glyphs only: target font |
| 216 | + */ |
| 217 | + public ImFont getFont() { |
| 218 | + return new ImFont(nGetFont()); |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * For custom font glyphs only: target font |
| 223 | + */ |
| 224 | + public void setFont(final ImFont value) { |
| 225 | + nSetFont(value.ptr); |
| 226 | + } |
| 227 | + |
| 228 | + private native long nGetFont(); /* |
| 229 | + return (uintptr_t)THIS->Font; |
| 230 | + */ |
| 231 | + |
| 232 | + private native void nSetFont(long value); /* |
| 233 | + THIS->Font = reinterpret_cast<ImFont*>(value); |
| 234 | + */ |
| 235 | + |
| 236 | + public boolean isPacked() { |
| 237 | + return nIsPacked(); |
| 238 | + } |
| 239 | + |
| 240 | + private native boolean nIsPacked(); /* |
| 241 | + return THIS->IsPacked(); |
| 242 | + */ |
| 243 | + |
| 244 | + /*JNI |
| 245 | + #undef THIS |
| 246 | + */ |
| 247 | +} |
0 commit comments