Nuklear immediate-mode graphical user interface for pntr.
#define PNTR_NUKLEAR_IMPLEMENTATION
#include "pntr_nuklear.h"
int main() {
// Initialize
pntr_font* font = pntr_load_font_default();
struct nk_context* ctx = pntr_load_nuklear(font);
// Nuklear GUI Code
if (nk_begin(ctx, "Hello World", nk_rect(50, 50, 200, 150),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
nk_layout_row_dynamic(ctx, 0, 1);
if (nk_button_label(ctx, "Button")) {
printf("Hello World!\n");
}
}
nk_end(ctx);
// Render
pntr_draw_nuklear(screen, ctx);
// Unload
pntr_unload_nuklear(ctx);
pntr_unload_font(font);
return 0;
}
struct nk_context* pntr_load_nuklear(pntr_font* font);
void pntr_unload_nuklear(struct nk_context* ctx);
void pntr_nuklear_update(struct nk_context* ctx, pntr_app* app);
void pntr_draw_nuklear(pntr_image* dst, struct nk_context* ctx);
struct nk_rect pntr_rectangle_to_nk_rect(pntr_rectangle rectangle);
pntr_color pntr_color_from_nk_color(struct nk_color color);
struct nk_color pntr_color_to_nk_color(pntr_color color);
pntr_vector pntr_vector_from_nk_vec2i(struct nk_vec2i vector);
pntr_color pntr_color_from_nk_colorf(struct nk_colorf color);
Unless stated otherwise, all works are:
- Copyright (c) 2023 Rob Loach
... and licensed under: