50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
#ifndef PIXELDEFENSE_UI_H
|
|
#define PIXELDEFENSE_UI_H
|
|
|
|
#include <breeze.h>
|
|
#include <raygui.h>
|
|
|
|
typedef struct UIGrid {
|
|
i32 rows;
|
|
i32 cols;
|
|
f32 rowPadding;
|
|
f32 cellPadding;
|
|
Rectangle bounds;
|
|
} UIGrid;
|
|
|
|
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);
|
|
|
|
Rectangle uiGridCell(const UIGrid grid, i32 row, i32 col);
|
|
Rectangle uiGridCellSpan(const UIGrid grid, i32 row, i32 col, i32 rowSpan, i32 colSpan);
|
|
|
|
void uiGridDrawCells(const UIGrid grid);
|
|
|
|
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
|