Add nuklear ui library
This commit is contained in:
@@ -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)
|
||||
|
||||
39
engine/tests/nuklear_test.c
Normal file
39
engine/tests/nuklear_test.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user