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