Class NkCursor

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class NkCursor extends Struct<NkCursor> implements NativeResource

 struct nk_cursor {
     struct nk_image img;
     struct nk_vec2 size;
     struct nk_vec2 offset;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • IMG

      public static final int IMG
      The struct member offsets.
    • SIZE

      public static final int SIZE
      The struct member offsets.
    • OFFSET

      public static final int OFFSET
      The struct member offsets.
  • Constructor Details

    • NkCursor

      public NkCursor(ByteBuffer container)
      Creates a NkCursor 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 Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<NkCursor>
    • img

      public NkImage img()
      Returns:
      a NkImage view of the img field.
    • size

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

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

      public NkCursor img(NkImage value)
      Copies the specified NkImage to the img field.
    • img

      public NkCursor img(Consumer<NkImage> consumer)
      Passes the img field to the specified Consumer.
    • size

      public NkCursor size(NkVec2 value)
      Copies the specified NkVec2 to the size field.
    • size

      public NkCursor size(Consumer<NkVec2> consumer)
      Passes the size field to the specified Consumer.
    • offset

      public NkCursor offset(NkVec2 value)
      Copies the specified NkVec2 to the offset field.
    • offset

      public NkCursor offset(Consumer<NkVec2> consumer)
      Passes the offset field to the specified Consumer.
    • set

      public NkCursor set(NkImage img, NkVec2 size, NkVec2 offset)
      Initializes this struct with the specified values.
    • set

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

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

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

      public static NkCursor create()
      Returns a new NkCursor instance allocated with BufferUtils.
    • create

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

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

      public static NkCursor.Buffer malloc(int capacity)
      Returns a new NkCursor.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static NkCursor.Buffer calloc(int capacity)
      Returns a new NkCursor.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static NkCursor.Buffer create(int capacity)
      Returns a new NkCursor.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

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

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

      public static NkCursor malloc(MemoryStack stack)
      Returns a new NkCursor instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

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

      public static NkCursor.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new NkCursor.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static NkCursor.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new NkCursor.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nimg

      public static NkImage nimg(long struct)
      Unsafe version of img().
    • nsize

      public static NkVec2 nsize(long struct)
      Unsafe version of size().
    • noffset

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

      public static void nimg(long struct, NkImage value)
      Unsafe version of img.
    • nsize

      public static void nsize(long struct, NkVec2 value)
      Unsafe version of size.
    • noffset

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