Class NkUserFontGlyph

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class NkUserFontGlyph
    extends Struct
    implements NativeResource

    Member documentation

    • uv[2] – texture coordinates
    • offset – offset between top left and glyph
    • width – width of the glyph
    • height – height of the glyph
    • xadvance – offset to the next glyph

    Layout

    
     struct nk_user_font_glyph {
         struct nk_vec2 uv[2];
         struct nk_vec2 offset;
         float width;
         float height;
         float xadvance;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • UV, OFFSET, WIDTH, HEIGHT, XADVANCE

        The struct member offsets.
    • Constructor Detail

      • NkUserFontGlyph

        public NkUserFontGlyph​(java.nio.ByteBuffer container)
        Creates a NkUserFontGlyph instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • uv

        public NkVec2 uv​(int index)
        Returns a NkVec2 view of the struct at the specified index of the uv field.
      • offset

        public NkVec2 offset()
        Returns a NkVec2 view of the offset field.
      • width

        public float width()
        Returns the value of the width field.
      • height

        public float height()
        Returns the value of the height field.
      • xadvance

        public float xadvance()
        Returns the value of the xadvance field.
      • uv

        public NkUserFontGlyph uv​(int index,
                                  java.util.function.Consumer<NkVec2> consumer)
        Passes the element at index of the uv field to the specified Consumer.
      • offset

        public NkUserFontGlyph offset​(java.util.function.Consumer<NkVec2> consumer)
        Passes the offset field to the specified Consumer.
      • width

        public NkUserFontGlyph width​(float value)
        Sets the specified value to the width field.
      • height

        public NkUserFontGlyph height​(float value)
        Sets the specified value to the height field.
      • xadvance

        public NkUserFontGlyph xadvance​(float value)
        Sets the specified value to the xadvance field.
      • set

        public NkUserFontGlyph set​(NkUserFontGlyph src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

        public static NkUserFontGlyph malloc()
        Returns a new NkUserFontGlyph instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static NkUserFontGlyph calloc()
        Returns a new NkUserFontGlyph instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static NkUserFontGlyph create​(long address)
        Returns a new NkUserFontGlyph instance for the specified memory address.
      • createSafe

        @Nullable
        public static NkUserFontGlyph createSafe​(long address)
        Like create, but returns null if address is NULL.
      • create

        public static NkUserFontGlyph.Buffer create​(long address,
                                                    int capacity)
        Create a NkUserFontGlyph.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static NkUserFontGlyph.Buffer createSafe​(long address,
                                                        int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static NkUserFontGlyph mallocStack()
        Returns a new NkUserFontGlyph instance allocated on the thread-local MemoryStack.
      • callocStack

        public static NkUserFontGlyph callocStack()
        Returns a new NkUserFontGlyph instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static NkUserFontGlyph mallocStack​(MemoryStack stack)
        Returns a new NkUserFontGlyph instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static NkUserFontGlyph callocStack​(MemoryStack stack)
        Returns a new NkUserFontGlyph instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • nuv

        public static NkVec2 nuv​(long struct,
                                 int index)
        Unsafe version of uv.
      • noffset

        public static NkVec2 noffset​(long struct)
        Unsafe version of offset().
      • nwidth

        public static float nwidth​(long struct)
        Unsafe version of width().
      • nheight

        public static float nheight​(long struct)
        Unsafe version of height().
      • nxadvance

        public static float nxadvance​(long struct)
        Unsafe version of xadvance().
      • nuv

        public static void nuv​(long struct,
                               NkVec2.Buffer value)
        Unsafe version of uv.
      • nuv

        public static void nuv​(long struct,
                               int index,
                               NkVec2 value)
        Unsafe version of uv.
      • noffset

        public static void noffset​(long struct,
                                   NkVec2 value)
        Unsafe version of offset.
      • nwidth

        public static void nwidth​(long struct,
                                  float value)
        Unsafe version of width.
      • nheight

        public static void nheight​(long struct,
                                   float value)
        Unsafe version of height.
      • nxadvance

        public static void nxadvance​(long struct,
                                     float value)
        Unsafe version of xadvance.