Add nuklear ui library

This commit is contained in:
2023-11-08 09:34:44 +01:00
parent be711f2fa1
commit 16972e4f9a
6 changed files with 31031 additions and 1 deletions

View File

@@ -1,4 +1,7 @@
project(BreezeTests)
add_executable(window_test window_test.c)
target_link_libraries(window_test LINK_PRIVATE Breeze)
target_link_libraries(window_test LINK_PRIVATE Breeze)
add_executable(nuklear_test nuklear_test.c)
target_link_libraries(nuklear_test LINK_PRIVATE Breeze)

View File

@@ -0,0 +1,39 @@
#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;
}