Compare commits
No commits in common. "04a612e0c1e60dd2e721aff32dbe53d775f5b921" and "89f21718cad3ed2ea4eaf14fade5a0ff0b57df12" have entirely different histories.
04a612e0c1
...
89f21718ca
|
@ -1,77 +1,62 @@
|
|||
#include "application.h"
|
||||
|
||||
#include "defs.h"
|
||||
#include "style.h"
|
||||
#include <SDL3/SDL.h>
|
||||
#include <clay/clay.h>
|
||||
|
||||
static inline void DiceSelectorContainer() {
|
||||
CLAY(CLAY_ID("DiceSelector"), {
|
||||
.layout = {
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
.sizing = { CLAY_SIZING_FIXED(300), CLAY_SIZING_GROW(0) },
|
||||
.padding = containerPadding,
|
||||
.childGap = paragraphGap,
|
||||
},
|
||||
.INNER_CONTAINER(0)
|
||||
}) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ActiveDiceContainer() {
|
||||
CLAY(CLAY_ID("ActiveDice"), {
|
||||
.layout = {
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
.sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_GROW(0) },
|
||||
.padding = containerPadding,
|
||||
.childGap = paragraphGap,
|
||||
},
|
||||
.INNER_CONTAINER(0)
|
||||
}) {
|
||||
CLAY_TEXT(CLAY_STRING("Header Text"), CLAY_TEXT_CONFIG({
|
||||
.H(1, 0),
|
||||
}));
|
||||
CLAY_TEXT(CLAY_STRING("Content text"), CLAY_TEXT_CONFIG({
|
||||
.BODY(0),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void DiceContainer() {
|
||||
static inline
|
||||
void DiceContainer() {
|
||||
CLAY(CLAY_ID("DiceContainer"), {
|
||||
.layout = {
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||
.sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_PERCENT(0.4) },
|
||||
.childGap = containerGap
|
||||
.sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_PERCENT(0.2) },
|
||||
.padding = CLAY_PADDING_ALL(16),
|
||||
},
|
||||
.backgroundColor = containerColors[0],
|
||||
.cornerRadius = defaultRadiusAll,
|
||||
}) {
|
||||
DiceSelectorContainer();
|
||||
ActiveDiceContainer();
|
||||
CLAY_TEXT(CLAY_STRING("Text data"), CLAY_TEXT_CONFIG({
|
||||
TEXT_BODY,
|
||||
.textColor = textColors[0]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void DiceLogContainer() {
|
||||
static inline
|
||||
void DiceLogContainer() {
|
||||
CLAY(CLAY_ID("LogContainer"), {
|
||||
.layout = {
|
||||
.sizing = layoutExpand,
|
||||
.padding = CLAY_PADDING_ALL(16),
|
||||
},
|
||||
.INNER_CONTAINER(0)
|
||||
.backgroundColor = containerColors[0],
|
||||
.cornerRadius = defaultRadiusAll
|
||||
}) {}
|
||||
}
|
||||
|
||||
static inline void InitiativeListContainer() {
|
||||
static inline
|
||||
void InitiativeListContainer() {
|
||||
CLAY(CLAY_ID("InitiativeListContainer"), {
|
||||
.layout = {
|
||||
.sizing = layoutExpand,
|
||||
.padding = CLAY_PADDING_ALL(16),
|
||||
},
|
||||
.INNER_CONTAINER(0)
|
||||
.backgroundColor = containerColors[0],
|
||||
.cornerRadius = defaultRadiusAll,
|
||||
}) {}
|
||||
}
|
||||
|
||||
Clay_RenderCommandArray RenderApplication() {
|
||||
Clay_BeginLayout();
|
||||
CLAY(CLAY_ID("OuterContainer"), windowStyle) {
|
||||
CLAY(CLAY_ID("OuterContainer"), {
|
||||
.layout = {
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
.sizing = layoutExpand,
|
||||
.padding = CLAY_PADDING_ALL(windowPadding),
|
||||
.childGap = containerGap,
|
||||
},
|
||||
.backgroundColor = windowBackground
|
||||
}) {
|
||||
DiceContainer();
|
||||
CLAY(CLAY_ID("LowerSplitContainer"), {
|
||||
.layout = {
|
||||
|
|
84
src/style.h
84
src/style.h
|
@ -3,16 +3,25 @@
|
|||
|
||||
#include "defs.h"
|
||||
#include <clay/clay.h>
|
||||
#include <stdint.h>
|
||||
|
||||
////////////////////////////////////
|
||||
// CONTAINER STYLE
|
||||
////////////////////////////////////
|
||||
constexpr float defaultRadius = 5.f;
|
||||
constexpr Clay_CornerRadius defaultRadiusAll = {
|
||||
defaultRadius, defaultRadius,
|
||||
defaultRadius, defaultRadius
|
||||
};
|
||||
constexpr float containerGap = 5.f;
|
||||
constexpr float windowPadding = 5.f;
|
||||
|
||||
constexpr uint16_t containerGap = 5;
|
||||
constexpr Clay_Padding containerPadding = {
|
||||
32, 32,
|
||||
16, 16
|
||||
|
||||
#define TEXT_BODY\
|
||||
.fontId = FONT_DEFAULT,\
|
||||
.fontSize = 15
|
||||
#define TEXT_H1\
|
||||
.fontId = FONT_BOLD,\
|
||||
.fontSize = 20
|
||||
|
||||
constexpr Clay_Color windowBackground = {
|
||||
255*0.35, 255*0.35, 255*0.35, 255
|
||||
};
|
||||
constexpr Clay_Color containerColors[] = {
|
||||
{ 255*0.25, 255*0.25, 255*0.25, 255 },
|
||||
|
@ -20,68 +29,15 @@ constexpr Clay_Color containerColors[] = {
|
|||
{ 255*0.1, 255*0.1, 255*0.1, 255 },
|
||||
};
|
||||
|
||||
constexpr Clay_Sizing layoutExpand = {
|
||||
.width = CLAY_SIZING_GROW(0),
|
||||
.height = CLAY_SIZING_GROW(0)
|
||||
};
|
||||
|
||||
constexpr float defaultRadius = 5.f;
|
||||
constexpr Clay_CornerRadius defaultRadiusAll = {
|
||||
defaultRadius, defaultRadius,
|
||||
defaultRadius, defaultRadius
|
||||
};
|
||||
|
||||
#define INNER_CONTAINER(depth_) \
|
||||
backgroundColor = containerColors[depth_],\
|
||||
.cornerRadius = defaultRadiusAll
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
// WINDOW STYLE
|
||||
////////////////////////////////////
|
||||
|
||||
constexpr float windowPadding = 5;
|
||||
constexpr Clay_Color windowBackground = {
|
||||
255*0.35, 255*0.35, 255*0.35, 255
|
||||
};
|
||||
constexpr Clay_ElementDeclaration windowStyle = {
|
||||
.layout = {
|
||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||
.sizing = layoutExpand,
|
||||
.padding = CLAY_PADDING_ALL(windowPadding),
|
||||
.childGap = containerGap,
|
||||
},
|
||||
.backgroundColor = windowBackground
|
||||
};
|
||||
|
||||
////////////////////////////////////
|
||||
// TEXT STYLE
|
||||
////////////////////////////////////
|
||||
|
||||
constexpr float paragraphGap = 10;
|
||||
constexpr uint16_t baseFontSize = 16;
|
||||
|
||||
constexpr Clay_Color textColors[] = {
|
||||
{ 250, 250, 250, 255 },
|
||||
{ 250, 250, 250, 255 },
|
||||
{ 250, 250, 250, 255 },
|
||||
};
|
||||
|
||||
constexpr uint16_t headerSizes[] = {
|
||||
64, 32, 28, 16
|
||||
constexpr Clay_Sizing layoutExpand = {
|
||||
.width = CLAY_SIZING_GROW(0),
|
||||
.height = CLAY_SIZING_GROW(0)
|
||||
};
|
||||
|
||||
#define TEXT_STYLE(color_)\
|
||||
textColor = textColors[color_]
|
||||
|
||||
#define BODY(color_)\
|
||||
fontId = FONT_DEFAULT,\
|
||||
.fontSize = baseFontSize,\
|
||||
.TEXT_STYLE(color_)
|
||||
|
||||
#define H(level_, color_)\
|
||||
fontId = FONT_BOLD,\
|
||||
.fontSize = headerSizes[(level_)-1],\
|
||||
.TEXT_STYLE(color_)
|
||||
|
||||
#endif // !STYLE_H
|
||||
|
|
Loading…
Reference in a new issue