Add main menu

This commit is contained in:
2023-12-21 19:06:02 +01:00
parent c7ae1279e3
commit 1b801caa82
5 changed files with 135 additions and 202 deletions

View File

@@ -1,49 +1,15 @@
#ifndef PIXELDEFENSE_UI_H
#define PIXELDEFENSE_UI_H
#ifndef PIXELDEFENSE_UI_WIDGETS_H
#define PIXELDEFENSE_UI_WIDGETS_H
#include <breeze.h>
#include <raygui.h>
typedef struct UIGrid {
i32 rows;
i32 cols;
f32 rowPadding;
f32 cellPadding;
Rectangle bounds;
} UIGrid;
extern BzUI *UI; // defined in main.c
UIGrid uiGridFromRoot(i32 width, i32 height);
UIGrid uiGridFromGrid(const UIGrid grid, i32 row, i32 col);
UIGrid uiGridFromGridSpan(const UIGrid grid, i32 row, i32 col, i32 rowSpan, i32 colSpan);
void uiPushDivParentPercentage(f32 xPercent, f32 yPercent);
Rectangle uiGridCell(const UIGrid grid, i32 row, i32 col);
Rectangle uiGridCellSpan(const UIGrid grid, i32 row, i32 col, i32 rowSpan, i32 colSpan);
void uiLargeLabel(const char *txt);
void uiGridDrawCells(const UIGrid grid);
bool uiLargeTextButton(const char *txt);
typedef enum UIFlexBoxFlag {
UI_FLEX_NONE = 0,
UI_FLEX_DIR_ROW = 0b1,
UI_FLEX_DIR_COLUMN = 0b10,
UI_FLEX_ALIGN_START = 0b100,
UI_FLEX_ALIGN_CENTER = 0b1000,
UI_FLEX_ALIGN_END = 0b10000,
UI_FLEX_JUSTIFY_START = 0b100000,
UI_FLEX_JUSTIFY_CENTER = 0b1000000,
UI_FLEX_JUSTIFY_END = 0b10000000,
} UIFlexBoxFlag;
typedef struct FlexBoxDesc {
Rectangle window;
UIFlexBoxFlag flags;
f32 padding;
} FlexBoxDesc;
void uiFlexBoxCalc(const FlexBoxDesc *desc, i32 numElements, ...);
static f32 uiScale() {
return GetScreenHeight() / 720.0f;
}
#endif //PIXELDEFENSE_UI_H
#endif //PIXELDEFENSE_UI_WIDGETS_H