Basic UI system
This commit is contained in:
@@ -19,3 +19,6 @@ target_link_libraries(array_test LINK_PRIVATE Breeze)
|
||||
|
||||
add_executable(pan_test pan_test.c)
|
||||
target_link_libraries(pan_test LINK_PRIVATE Breeze)
|
||||
|
||||
add_executable(ui_test ui_test.c)
|
||||
target_link_libraries(ui_test LINK_PRIVATE Breeze)
|
||||
|
||||
47
engine/tests/ui_test.c
Normal file
47
engine/tests/ui_test.c
Normal file
@@ -0,0 +1,47 @@
|
||||
#define BZ_ENTRYPOINT
|
||||
#include <breeze.h>
|
||||
|
||||
#include <raylib.h>
|
||||
#include <rlImGui.h>
|
||||
|
||||
BzUI *ui;
|
||||
|
||||
bool init(int *game) {
|
||||
rlImGuiSetup(true);
|
||||
|
||||
ui = bzUICreate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void render(float dt, int *game) {
|
||||
ClearBackground(WHITE);
|
||||
|
||||
|
||||
bzUIBegin(ui, GetScreenWidth(), GetScreenHeight());
|
||||
bzUIPushLayout(ui, *&(BzUILayout) {
|
||||
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
||||
.flags = BZ_UI_FLEX_DIR_COLUMN | BZ_UI_FLEX_ALIGN_CENTER | BZ_UI_FLEX_JUSTIFY_CENTER,
|
||||
});
|
||||
if (bzUIButton(ui, "Hello world", NULL)) {
|
||||
bzLogInfo("Hello world");
|
||||
}
|
||||
if (bzUIButton(ui, "foo", NULL)) {
|
||||
bzLogInfo("foo");
|
||||
}
|
||||
if (bzUIButton(ui, "bar", NULL)) {
|
||||
bzLogInfo("bar");
|
||||
}
|
||||
bzUIEnd(ui);
|
||||
|
||||
rlImGuiBegin();
|
||||
igShowDemoWindow(NULL);
|
||||
rlImGuiEnd();
|
||||
}
|
||||
|
||||
bool bzMain(BzAppDesc *appDesc, int argc, const char **argv) {
|
||||
appDesc->init = (BzAppInitFunc) init;
|
||||
appDesc->render = (BzAppRenderFunc) render;
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user