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 |
| nk_set_display_size | Sets the backend surface size used to keep popups on-screen |
| nk_set_display_bounds | Sets a display rectangle (non-zero origin) used to keep popups on-screen |