Proper build UI
This commit is contained in:
@@ -242,7 +242,7 @@ void uiGameResCount(i32 amount, i32 capacity, Rectangle icon, Texture2D texture)
|
||||
bzUIPopParent(UI);
|
||||
}
|
||||
|
||||
void uiGameBuild(const char *label, Rectangle rec, Texture2D tex, bool *selected) {
|
||||
void uiGameBuild(const char *label, Rectangle rec, Texture2D tex, bool canAfford, bool *selected) {
|
||||
f32 scl = uiGetScale();
|
||||
BzUINode *btn = bzUINodeMake(UI, bzUIKeyFromString(label), &(BzUINodeDesc) {
|
||||
.flags = BZ_UI_CLICKABLE | BZ_UI_ALIGN_CENTER | BZ_UI_DRAW_BORDER,
|
||||
@@ -255,10 +255,10 @@ void uiGameBuild(const char *label, Rectangle rec, Texture2D tex, bool *selected
|
||||
|
||||
BzUIInteraction inter = bzUIGetInteraction(UI, btn);
|
||||
|
||||
Color bgColor = DARKBROWN;
|
||||
Color bgColor = canAfford ? DARKBROWN : MAROON;
|
||||
if (*selected || inter.hovering)
|
||||
bgColor = BROWN;
|
||||
if (inter.clicked)
|
||||
bgColor = canAfford ? BROWN : RED;
|
||||
if (inter.clicked && canAfford)
|
||||
*selected = true;
|
||||
|
||||
bzUISetBackgroundStyle(UI, btn, (BzUIBackgroundStyle) {
|
||||
|
||||
Reference in New Issue
Block a user