feat: formatting rules changes
This commit is contained in:
		
							parent
							
								
									c341f034fa
								
							
						
					
					
						commit
						dadbbb7697
					
				|  | @ -1,34 +1,14 @@ | |||
| --- | ||||
| BasedOnStyle: Microsoft | ||||
| AccessModifierOffset: -4 | ||||
| AlignAfterOpenBracket: Align | ||||
| AlignArrayOfStructures: Left | ||||
| AlignConsecutiveAssignments: | ||||
|   Enabled: false | ||||
|   AcrossEmptyLines: true | ||||
|   AcrossComments: true | ||||
|   AlignCompound: false | ||||
|   PadOperators: true | ||||
| AlignConsecutiveBitFields: | ||||
|   Enabled: false | ||||
|   AcrossEmptyLines: false | ||||
|   AcrossComments: false | ||||
|   AlignCompound: false | ||||
|   PadOperators: false | ||||
| AlignConsecutiveDeclarations: | ||||
|   Enabled: false | ||||
|   AcrossEmptyLines: false | ||||
|   AcrossComments: false | ||||
|   AlignCompound: false | ||||
|   PadOperators: false | ||||
| AlignConsecutiveMacros: | ||||
|   Enabled: false | ||||
|   AcrossEmptyLines: false | ||||
|   AcrossComments: false | ||||
|   AlignCompound: false | ||||
|   PadOperators: false | ||||
| AlignAfterOpenBracket: DontAlign | ||||
| AlignArrayOfStructures: None | ||||
| AlignConsecutiveAssignments: None | ||||
| AlignConsecutiveBitFields: None | ||||
| AlignConsecutiveDeclarations: None | ||||
| AlignConsecutiveMacros: None | ||||
| AlignEscapedNewlines: Right | ||||
| AlignOperands: Align | ||||
| AlignOperands: DontAlign | ||||
| AlignTrailingComments: | ||||
|   Kind: Always | ||||
|   OverEmptyLines: 0 | ||||
|  | @ -50,6 +30,11 @@ AttributeMacros: | |||
| BinPackArguments: true | ||||
| BinPackParameters: true | ||||
| BitFieldColonSpacing: Both | ||||
| BreakAfterAttributes: Never | ||||
| BreakAfterJavaFieldAnnotations: false | ||||
| BreakArrays: false | ||||
| BreakBeforeBinaryOperators: None | ||||
| BreakBeforeBraces: Custom | ||||
| BraceWrapping: | ||||
|   AfterCaseLabel: false | ||||
|   AfterClass: false | ||||
|  | @ -69,18 +54,13 @@ BraceWrapping: | |||
|   SplitEmptyFunction: false | ||||
|   SplitEmptyRecord: false | ||||
|   SplitEmptyNamespace: false | ||||
| BreakAfterAttributes: Never | ||||
| BreakAfterJavaFieldAnnotations: false | ||||
| BreakArrays: true | ||||
| BreakBeforeBinaryOperators: None | ||||
| BreakBeforeBraces: Custom | ||||
| BreakBeforeConceptDeclarations: Always | ||||
| BreakBeforeInlineASMColon: OnlyMultiline | ||||
| BreakBeforeTernaryOperators: true | ||||
| BreakConstructorInitializers: BeforeColon | ||||
| BreakConstructorInitializers: BeforeComma | ||||
| BreakInheritanceList: BeforeColon | ||||
| BreakStringLiterals: true | ||||
| ColumnLimit: 120 | ||||
| ColumnLimit: 0 | ||||
| CommentPragmas: "^ IWYU pragma:" | ||||
| CompactNamespaces: false | ||||
| ConstructorInitializerIndentWidth: 4 | ||||
|  | @ -123,8 +103,8 @@ IndentPPDirectives: None | |||
| IndentRequiresClause: true | ||||
| IndentWidth: 4 | ||||
| IndentWrappedFunctionNames: false | ||||
| InsertBraces: false | ||||
| InsertNewlineAtEOF: false | ||||
| InsertBraces: true | ||||
| InsertNewlineAtEOF: true | ||||
| InsertTrailingCommas: None | ||||
| IntegerLiteralSeparator: | ||||
|   Binary: 0 | ||||
|  |  | |||
|  | @ -4,39 +4,10 @@ | |||
| #include <SDL3/SDL.h> | ||||
| #include <clay/clay.h> | ||||
| 
 | ||||
| static inline | ||||
| void DiceLogContainer() { | ||||
| 	CLAY(CLAY_ID("LogContainer"), PanelContainer(0, (Clay_ElementDeclaration) { | ||||
| 		.layout = { | ||||
| 			.sizing = layoutExpand, | ||||
| 			.padding = CLAY_PADDING_ALL(16), | ||||
| 		}, | ||||
| 	})) {} | ||||
| } | ||||
| 
 | ||||
| static inline | ||||
| void InitiativeListContainer() { | ||||
| 	CLAY(CLAY_ID("InitiativeListContainer"), PanelContainer(0, (Clay_ElementDeclaration) { | ||||
| 		.layout = { | ||||
| 			.sizing = layoutExpand, | ||||
| 			.padding = CLAY_PADDING_ALL(16), | ||||
| 		}, | ||||
| 	})) {} | ||||
| } | ||||
| 
 | ||||
| Clay_RenderCommandArray RenderApplication() { | ||||
| 	Clay_BeginLayout(); | ||||
| 	CLAY(CLAY_ID("OuterContainer"), WindowStyle()) { | ||||
| 		DiceContainer(); | ||||
| 		CLAY(CLAY_ID("LowerSplitContainer"), { | ||||
| 			.layout = { | ||||
| 				.sizing = layoutExpand, | ||||
| 				.childGap = containerGap | ||||
| 			}, | ||||
| 		}) { | ||||
| 			DiceLogContainer(); | ||||
| 			InitiativeListContainer(); | ||||
| 		} | ||||
| 	} | ||||
| 	return Clay_EndLayout(); | ||||
| } | ||||
|  |  | |||
|  | @ -1,70 +1,69 @@ | |||
| #include "dice_container.h" | ||||
| #include "dice.h" | ||||
| #include "elements.h" | ||||
| #include "style.h" | ||||
| #include "ui_data.h" | ||||
| #include <SDL3/SDL_mouse.h> | ||||
| #include <SDL3_image/SDL_image.h> | ||||
| #include <clay/clay.h> | ||||
| #include <stdint.h> | ||||
| #include "elements.h" | ||||
| #include "style.h" | ||||
| #include "dice.h" | ||||
| #include "ui_data.h" | ||||
| 
 | ||||
| static | ||||
| void HandleRollSetButtonInteraction(Clay_ElementId element, Clay_PointerData pointer, intptr_t data) { | ||||
| 	if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| static void HandleRollSetButtonInteraction(Clay_ElementId element, | ||||
| 	Clay_PointerData pointer, | ||||
| 	intptr_t data) { | ||||
| 	if(pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| 		Dice_RollActiveSet(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static | ||||
| void HandleClearSetButtonInteraction(Clay_ElementId element, Clay_PointerData pointer, intptr_t data) { | ||||
| 	if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| static void HandleClearSetButtonInteraction(Clay_ElementId element, | ||||
| 	Clay_PointerData pointer, | ||||
| 	intptr_t data) { | ||||
| 	if(pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| 		Dice_ClearActiveSet(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static | ||||
| void HandleAddDieButtonInteraction(Clay_ElementId element, Clay_PointerData pointer, intptr_t die) { | ||||
| 	if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| static void HandleAddDieButtonInteraction(Clay_ElementId element, | ||||
| 	Clay_PointerData pointer, | ||||
| 	intptr_t die) { | ||||
| 	if(pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| 		Dice_AddToActiveSet((enum Dice_Die)die); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static inline | ||||
| void AddDieButton(enum Dice_Die die) { | ||||
| static inline void AddDieButton(enum Dice_Die die) { | ||||
| 	CLAY(CLAY_IDI("AddDieButton", die), { | ||||
| 		.layout = { | ||||
| 			.sizing = { CLAY_SIZING_FIXED(100), CLAY_SIZING_FIXED(100) }, | ||||
| 			.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }, | ||||
| 			.sizing = {CLAY_SIZING_FIXED(100), CLAY_SIZING_FIXED(100)}, | ||||
| 			.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, | ||||
| 		}, | ||||
| 		.image = { GetDiceImage(die, Clay_Hovered()) }, | ||||
| 		.image = {GetDiceImage(die, Clay_Hovered())}, | ||||
| 	}) { | ||||
| 		Clay_OnHover(&HandleAddDieButtonInteraction, die); | ||||
| 		CLAY_TEXT(Dice_ToString(die), CLAY_TEXT_CONFIG(Header(2, { | ||||
| 			.textColor = TextColors(0), | ||||
| 			.textAlignment = CLAY_TEXT_ALIGN_CENTER, | ||||
| 		}))); | ||||
| 		CLAY_TEXT(Dice_ToString(die), CLAY_TEXT_CONFIG(Header(2, {.textColor = TextColors(0), .textAlignment = CLAY_TEXT_ALIGN_CENTER}))); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static inline | ||||
| void DiceSelectorContainer() { | ||||
| static inline void DiceSelectorContainer() { | ||||
| 	CLAY(CLAY_ID("DiceSelector"), | ||||
| 		PanelContainer(0, (Clay_ElementDeclaration) { | ||||
| 		PanelContainer(0, (Clay_ElementDeclaration){ | ||||
| 			.layout = { | ||||
| 				.sizing = { CLAY_SIZING_FIT(), CLAY_SIZING_GROW() }, | ||||
| 			} | ||||
| 		} | ||||
| 	)) { | ||||
| 				.sizing = {CLAY_SIZING_FIT(), CLAY_SIZING_GROW()} | ||||
| 			}} | ||||
| 		)) { | ||||
| 		CLAY_AUTO_ID(ListContainer(0, { | ||||
| 			.layout = { | ||||
| 				.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_GROW() }, | ||||
| 				.padding = { 2, 2, 5, 5 }, | ||||
| 				.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_TOP }, | ||||
| 				.layoutDirection = CLAY_TOP_TO_BOTTOM, | ||||
| 					.sizing = {CLAY_SIZING_GROW(), CLAY_SIZING_GROW()}, | ||||
| 					.padding = {2, 2, 5, 5}, | ||||
| 					.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_TOP}, | ||||
| 					.layoutDirection = CLAY_TOP_TO_BOTTOM, | ||||
| 			}, | ||||
| 			.clip = { | ||||
| 				false, true, Clay_GetScrollOffset(), | ||||
| 			}, | ||||
| 					false, | ||||
| 					true, | ||||
| 					Clay_GetScrollOffset(), | ||||
| 				}, | ||||
| 		})) { | ||||
| 			AddDieButton(D4); | ||||
| 			AddDieButton(D6); | ||||
|  | @ -78,23 +77,21 @@ void DiceSelectorContainer() { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| static | ||||
| void HandleRemoveDieButtonInteraction(Clay_ElementId element, Clay_PointerData pointer, intptr_t index) { | ||||
| 	if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| static void HandleRemoveDieButtonInteraction(Clay_ElementId element, | ||||
| 	Clay_PointerData pointer, | ||||
| 	intptr_t index) { | ||||
| 	if(pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) { | ||||
| 		Dice_RemoveFromActiveSet((size_t)index); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static inline | ||||
| void RemoveDieButton(enum Dice_Die die, size_t index) { | ||||
| static inline void RemoveDieButton(enum Dice_Die die, size_t index) { | ||||
| 	CLAY(CLAY_IDI("RemoveDieButton", index), { | ||||
| 		.layout = { | ||||
| 			.sizing = { CLAY_SIZING_FIXED(200), CLAY_SIZING_FIXED(200) }, | ||||
| 			.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }, | ||||
| 		}, | ||||
| 		.image = { | ||||
| 			GetDiceImage(die, Clay_Hovered()) | ||||
| 				.sizing = {CLAY_SIZING_FIXED(200), CLAY_SIZING_FIXED(200)}, | ||||
| 				.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, | ||||
| 		}, | ||||
| 		.image = {GetDiceImage(die, Clay_Hovered())}, | ||||
| 	}) { | ||||
| 		Clay_OnHover(&HandleRemoveDieButtonInteraction, (intptr_t)index); | ||||
| 		size_t result_length; | ||||
|  | @ -102,56 +99,49 @@ void RemoveDieButton(enum Dice_Die die, size_t index) { | |||
| 		CLAY_TEXT( | ||||
| 			UiData_StoreClayStr(Dice_ResultToString(result[index])), | ||||
| 			CLAY_TEXT_CONFIG(Header(1, { | ||||
| 					.textColor = TextColors(0), | ||||
| 					.textAlignment = CLAY_TEXT_ALIGN_CENTER, | ||||
| 				} | ||||
| 			)) | ||||
| 		); | ||||
| 				.textColor = TextColors(0), | ||||
| 				.textAlignment = CLAY_TEXT_ALIGN_CENTER, | ||||
| 			}))); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| static inline | ||||
| void ActiveDiceContainer() { | ||||
| static inline void ActiveDiceContainer() { | ||||
| 	CLAY(CLAY_ID("ActiveDice"), PanelContainer(0, { | ||||
| 		.layout = { | ||||
| 			.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_GROW() }, | ||||
| 			.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }, | ||||
| 			.sizing = {CLAY_SIZING_GROW(), CLAY_SIZING_GROW()}, | ||||
| 			.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, | ||||
| 			.layoutDirection = CLAY_TOP_TO_BOTTOM, | ||||
| 		}, | ||||
| 	})) { | ||||
| 		CLAY(CLAY_ID("ActiveDiceInner"), { | ||||
| 			.layout = { | ||||
| 				.sizing = { CLAY_SIZING_FIT(), CLAY_SIZING_GROW() }, | ||||
| 				.padding = { 100, 100, 0, 0 }, | ||||
| 				.sizing = {CLAY_SIZING_FIT(), CLAY_SIZING_GROW()}, | ||||
| 				.padding = {100, 100, 0, 0}, | ||||
| 				.childGap = 16, | ||||
| 				.childAlignment = { CLAY_ALIGN_X_LEFT, CLAY_ALIGN_Y_CENTER }, | ||||
| 				.childAlignment = {CLAY_ALIGN_X_LEFT, CLAY_ALIGN_Y_CENTER}, | ||||
| 				.layoutDirection = CLAY_LEFT_TO_RIGHT, | ||||
| 			}, | ||||
| 			.clip = { | ||||
| 				true, true, { Clay_GetScrollOffset().x, 0 } | ||||
| 			} | ||||
| 		}) { | ||||
| 			.clip = { true, true, {Clay_GetScrollOffset().x, 0}}} | ||||
| 		) { | ||||
| 			size_t dice_count = 0; | ||||
| 			enum Dice_Die const *dice = Dice_GetActiveSet(&dice_count); | ||||
| 			for (size_t i = 0; i < dice_count; ++i) { | ||||
| 			for(size_t i = 0; i < dice_count; ++i) { | ||||
| 				RemoveDieButton(dice[i], i); | ||||
| 			} | ||||
| 		} | ||||
| 		CLAY(CLAY_ID("ActiveDiceControls"), { | ||||
| 			.layout = { | ||||
| 				.padding = { 0, 0, 0, 10 }, | ||||
| 				.padding = {0, 0, 0, 10}, | ||||
| 				.childGap = 20, | ||||
| 				.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER }, | ||||
| 				.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER}, | ||||
| 				.layoutDirection = CLAY_LEFT_TO_RIGHT, | ||||
| 			}, | ||||
| 		}) { | ||||
| 			TextButton(CLAY_STRING("Roll"), proceedButton, &HandleRollSetButtonInteraction, 0); | ||||
| 			int result = Dice_GetLastResultTotal(); | ||||
| 			CLAY_TEXT(UiData_StoreClayStr(Dice_ResultToString({ result, NONE })), | ||||
| 				CLAY_TEXT_CONFIG(Header(1, { | ||||
| 					.textColor = TextColors(0), | ||||
| 				})) | ||||
| 			); | ||||
| 			CLAY_TEXT(UiData_StoreClayStr(Dice_ResultToString({result, NONE})), CLAY_TEXT_CONFIG(Header(1, { | ||||
| 				.textColor = TextColors(0) | ||||
| 			}))); | ||||
| 			TextButton(CLAY_STRING("Clear"), warningButton, &HandleClearSetButtonInteraction, 0); | ||||
| 		} | ||||
| 	} | ||||
|  | @ -160,10 +150,10 @@ void ActiveDiceContainer() { | |||
| void DiceContainer() { | ||||
| 	CLAY(CLAY_ID("DiceContainer"), { | ||||
| 		.layout = { | ||||
| 			.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_PERCENT(0.4) }, | ||||
| 			.sizing = {CLAY_SIZING_GROW(), CLAY_SIZING_GROW()}, | ||||
| 			.childGap = containerGap, | ||||
| 			.layoutDirection = CLAY_LEFT_TO_RIGHT, | ||||
| 		}, | ||||
| 		} | ||||
| 	}) { | ||||
| 		DiceSelectorContainer(); | ||||
| 		ActiveDiceContainer(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue