68 lines
1.8 KiB
C
68 lines
1.8 KiB
C
#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());
|
|
static BzUIFlags flags = BZ_UI_FLEX_DIR_COLUMN | BZ_UI_FLEX_ALIGN_CENTER | BZ_UI_FLEX_JUSTIFY_CENTER;
|
|
static i32 width = 1280;
|
|
static i32 height = 720;
|
|
SetWindowSize(width, height);
|
|
bzUISetParentLayout(ui, *&(BzUILayout) {
|
|
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
|
.flags = flags
|
|
});
|
|
if (bzUIButton(ui, "Hello world")) {
|
|
bzLogInfo("Hello world");
|
|
}
|
|
if (bzUIButton(ui, "foo")) {
|
|
bzLogInfo("foo");
|
|
}
|
|
if (bzUIButton(ui, "bar")) {
|
|
bzLogInfo("bar");
|
|
}
|
|
bzUIEnd(ui);
|
|
|
|
rlImGuiBegin();
|
|
igBegin("DebugUI", NULL, 0);
|
|
igSliderInt("Width", &width, 200, 1600, "%d", 0);
|
|
igSliderInt("Height", &height, 100, 1000, "%d", 0);
|
|
const char *flexOpt[] = {"DIR_ROW", "DIR_COLUMN", "ALIGN_START",
|
|
"ALIGN_CENTER", "ALIGN_END", "JUSTIFY_START",
|
|
"JUSTIFY_CENTER", "JUSTIFY_END", "JUSTIFY_SPACE_BETWEEN",
|
|
"JUSTIFY_SPACE_AROUND", "JUSTIFY_SPACE_EVENLY"};
|
|
i32 numOpts = sizeof(flexOpt) / sizeof(*flexOpt);
|
|
for (i32 i = 0; i < numOpts; i++) {
|
|
bool opt = (flags & (1 << i)) != 0;
|
|
igCheckbox(flexOpt[i], &opt);
|
|
flags &= ~(1 << i);
|
|
if (opt)
|
|
flags |= (1 << i);
|
|
}
|
|
|
|
igEnd();
|
|
rlImGuiEnd();
|
|
}
|
|
|
|
bool bzMain(BzAppDesc *appDesc, int argc, const char **argv) {
|
|
appDesc->init = (BzAppInitFunc) init;
|
|
appDesc->render = (BzAppRenderFunc) render;
|
|
|
|
return true;
|
|
}
|