|
Nuklear
This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window/input handling but instead provides a highly modular, library-based approach, with simple input state for input and draw commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends, it focuses only on the actual UI.
|
Contexts are the main entry point and the majestro of nuklear and contain all required state.
They are used for window, memory, input, style, stack, commands and time management and need to be passed into all nuklear GUI specific functions.
To use a context it first has to be initialized which can be achieved by calling one of either nk_init_default, nk_init_fixed, nk_init, nk_init_custom. Each takes in a font handle and a specific way of handling memory. Memory control hereby ranges from standard library to just specifying a fixed sized block of memory which nuklear has to manage itself from.
| Function | Description |
|---|---|
| nk_init_default | Initializes context with standard library memory allocation (malloc,free) |
| nk_init_fixed | Initializes context from single fixed size memory block |
| nk_init | Initializes context with memory allocator callbacks for alloc and free |
| nk_init_custom | Initializes context from two buffers. One for draw commands the other for window/panel/table allocations |
| nk_clear | Called at the end of the frame to reset and prepare the context for the next frame |
| nk_free | Shutdown and free all memory allocated inside the context |
| nk_set_user_data | Utility function to pass user data to draw command |