39 lines
965 B
C
39 lines
965 B
C
#include <raylib-nuklear.h>
|
|
|
|
int main() {
|
|
InitWindow(640, 480, "raylib-nuklear example");
|
|
|
|
// Create the Nuklear Context
|
|
int fontSize = 10;
|
|
struct nk_context *ctx = InitNuklear(fontSize);
|
|
|
|
while (!WindowShouldClose()) {
|
|
// Update the Nuklear context, along with input
|
|
UpdateNuklear(ctx);
|
|
|
|
// Nuklear GUI Code
|
|
// https://github.com/Immediate-Mode-UI/Nuklear/wiki/Window
|
|
if (nk_begin(ctx, "Nuklear", nk_rect(100, 100, 220, 220),
|
|
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
|
|
if (nk_button_label(ctx, "Button")) {
|
|
// Button was clicked!
|
|
}
|
|
}
|
|
nk_end(ctx);
|
|
|
|
// Render
|
|
BeginDrawing();
|
|
ClearBackground(RAYWHITE);
|
|
|
|
// Render the Nuklear GUI
|
|
DrawNuklear(ctx);
|
|
|
|
EndDrawing();
|
|
}
|
|
|
|
// De-initialize the Nuklear GUI
|
|
UnloadNuklear(ctx);
|
|
|
|
CloseWindow();
|
|
return 0;
|
|
} |