feat: adjusted layout and styling logic
This commit is contained in:
		
							parent
							
								
									456921e66b
								
							
						
					
					
						commit
						a98a67024b
					
				| 
						 | 
					@ -3,61 +3,62 @@
 | 
				
			||||||
#include "defs.h"
 | 
					#include "defs.h"
 | 
				
			||||||
#include "style.h"
 | 
					#include "style.h"
 | 
				
			||||||
#include <SDL3/SDL.h>
 | 
					#include <SDL3/SDL.h>
 | 
				
			||||||
 | 
					#include <clay/clay.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline
 | 
					static inline
 | 
				
			||||||
void DiceContainer() {
 | 
					void DiceContainer() {
 | 
				
			||||||
	CLAY({ .id = CLAY_ID("DiceContainer"),
 | 
						CLAY(CLAY_ID("DiceContainer"), {
 | 
				
			||||||
		.layout = {
 | 
							.layout = {
 | 
				
			||||||
			.sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_PERCENT(0.2) },
 | 
								.sizing = { CLAY_SIZING_GROW(0), CLAY_SIZING_PERCENT(0.2) },
 | 
				
			||||||
			.padding = CLAY_PADDING_ALL(16),
 | 
								.padding = CLAY_PADDING_ALL(16),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		.backgroundColor = containerColors[0],
 | 
							.backgroundColor = containerColors[0],
 | 
				
			||||||
		.cornerRadius = CLAY_CORNER_RADIUS(cornerRadius)
 | 
							.cornerRadius = defaultRadiusAll,
 | 
				
			||||||
	}) {
 | 
						}) {
 | 
				
			||||||
		CLAY_TEXT(CLAY_STRING("Text data"), CLAY_TEXT_CONFIG({
 | 
							CLAY_TEXT(CLAY_STRING("Text data"), CLAY_TEXT_CONFIG({
 | 
				
			||||||
			.textColor = textColors[0],
 | 
								TEXT_BODY,
 | 
				
			||||||
			.fontId = FONT_DEFAULT,
 | 
								.textColor = textColors[0]
 | 
				
			||||||
			.fontSize = 24,
 | 
					 | 
				
			||||||
		}));
 | 
							}));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline
 | 
					static inline
 | 
				
			||||||
void DiceLogContainer() {
 | 
					void DiceLogContainer() {
 | 
				
			||||||
	CLAY({ .id = CLAY_ID("LogContainer"),
 | 
						CLAY(CLAY_ID("LogContainer"), {
 | 
				
			||||||
		.layout = {
 | 
							.layout = {
 | 
				
			||||||
			.sizing = layoutExpand,
 | 
								.sizing = layoutExpand,
 | 
				
			||||||
			.padding = CLAY_PADDING_ALL(16),
 | 
								.padding = CLAY_PADDING_ALL(16),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		.backgroundColor = containerColors[0],
 | 
							.backgroundColor = containerColors[0],
 | 
				
			||||||
		.cornerRadius = cornerRadiusAll
 | 
							.cornerRadius = defaultRadiusAll
 | 
				
			||||||
	}) {}
 | 
						}) {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline
 | 
					static inline
 | 
				
			||||||
void InitiativeListContainer() {
 | 
					void InitiativeListContainer() {
 | 
				
			||||||
	CLAY({ .id = CLAY_ID("InitiativeListContainer"),
 | 
						CLAY(CLAY_ID("InitiativeListContainer"), {
 | 
				
			||||||
		.layout = {
 | 
							.layout = {
 | 
				
			||||||
			.sizing = layoutExpand,
 | 
								.sizing = layoutExpand,
 | 
				
			||||||
			.padding = CLAY_PADDING_ALL(16),
 | 
								.padding = CLAY_PADDING_ALL(16),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		.backgroundColor = containerColors[0],
 | 
							.backgroundColor = containerColors[0],
 | 
				
			||||||
		.cornerRadius = cornerRadiusAll,
 | 
							.cornerRadius = defaultRadiusAll,
 | 
				
			||||||
	}) {}
 | 
						}) {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Clay_RenderCommandArray RenderApplication() {
 | 
					Clay_RenderCommandArray RenderApplication() {
 | 
				
			||||||
	Clay_BeginLayout();
 | 
						Clay_BeginLayout();
 | 
				
			||||||
	CLAY({ .id = CLAY_ID("OuterContainer"),
 | 
						CLAY(CLAY_ID("OuterContainer"), {
 | 
				
			||||||
		.layout = {
 | 
							.layout = {
 | 
				
			||||||
			.layoutDirection = CLAY_TOP_TO_BOTTOM,
 | 
								.layoutDirection = CLAY_TOP_TO_BOTTOM,
 | 
				
			||||||
			.sizing = layoutExpand,
 | 
								.sizing = layoutExpand,
 | 
				
			||||||
			.padding = CLAY_PADDING_ALL(windowPadding),
 | 
								.padding = CLAY_PADDING_ALL(windowPadding),
 | 
				
			||||||
			.childGap = containerGap
 | 
								.childGap = containerGap,
 | 
				
			||||||
		}
 | 
							},
 | 
				
			||||||
 | 
							.backgroundColor = windowBackground
 | 
				
			||||||
	}) {
 | 
						}) {
 | 
				
			||||||
		DiceContainer();
 | 
							DiceContainer();
 | 
				
			||||||
		CLAY({ .id = CLAY_ID("LowerSplitContainer"),
 | 
							CLAY(CLAY_ID("LowerSplitContainer"), {
 | 
				
			||||||
			.layout = {
 | 
								.layout = {
 | 
				
			||||||
				.sizing = layoutExpand,
 | 
									.sizing = layoutExpand,
 | 
				
			||||||
				.childGap = containerGap
 | 
									.childGap = containerGap
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										21
									
								
								src/style.h
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								src/style.h
									
									
									
									
									
								
							| 
						 | 
					@ -1,15 +1,24 @@
 | 
				
			||||||
#ifndef STYLE_H
 | 
					#ifndef STYLE_H
 | 
				
			||||||
#define STYLE_H
 | 
					#define STYLE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "defs.h"
 | 
				
			||||||
#include <clay/clay.h>
 | 
					#include <clay/clay.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
constexpr float cornerRadius = 20.f;
 | 
					constexpr float defaultRadius = 5.f;
 | 
				
			||||||
constexpr Clay_CornerRadius cornerRadiusAll = {
 | 
					constexpr Clay_CornerRadius defaultRadiusAll = {
 | 
				
			||||||
	cornerRadius, cornerRadius,
 | 
						defaultRadius, defaultRadius,
 | 
				
			||||||
	cornerRadius, cornerRadius
 | 
						defaultRadius, defaultRadius
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
constexpr float containerGap = 10.f;
 | 
					constexpr float containerGap = 5.f;
 | 
				
			||||||
constexpr float windowPadding = 10.f;
 | 
					constexpr float windowPadding = 5.f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define TEXT_BODY\
 | 
				
			||||||
 | 
						.fontId = FONT_DEFAULT,\
 | 
				
			||||||
 | 
						.fontSize = 15
 | 
				
			||||||
 | 
					#define TEXT_H1\
 | 
				
			||||||
 | 
						.fontId = FONT_BOLD,\
 | 
				
			||||||
 | 
						.fontSize = 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
constexpr Clay_Color windowBackground = {
 | 
					constexpr Clay_Color windowBackground = {
 | 
				
			||||||
	255*0.35, 255*0.35, 255*0.35, 255
 | 
						255*0.35, 255*0.35, 255*0.35, 255
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue