Class NkCursor

    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • IMG, SIZE, OFFSET

        The struct member offsets.
    • Constructor Detail

      • NkCursor

        public NkCursor​(java.nio.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 Detail

      • sizeof

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

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

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

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

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

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

        public NkCursor offset​(NkVec2 value)
        Copies the specified NkVec2 to the offset field.
      • 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​(long address)
        Returns a new NkCursor instance for the specified memory address.
      • createSafe

        @Nullable
        public static 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​(long address,
                                             int capacity)
        Create a NkCursor.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

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

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

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

        public static NkCursor callocStack​(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
      • callocStack

        public static NkCursor.Buffer callocStack​(int capacity)
        Returns a new NkCursor.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static NkCursor.Buffer callocStack​(int capacity,
                                                  MemoryStack stack)
        Returns a new NkCursor.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • 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.