Compare commits
10 commits
e5591a18d8
...
c61bb3acd9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c61bb3acd9 | ||
|
|
dadbbb7697 | ||
|
|
c341f034fa | ||
|
|
59fec07d69 | ||
|
|
f1dbccdd17 | ||
|
|
001eeae689 | ||
|
|
dcb8f35d5e | ||
|
|
9acea87ab8 | ||
|
|
00569f2ef1 | ||
|
|
9cf17fe2b9 |
204
.clang-format
Normal file
204
.clang-format
Normal file
|
|
@ -0,0 +1,204 @@
|
||||||
|
---
|
||||||
|
BasedOnStyle: Microsoft
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignArrayOfStructures: None
|
||||||
|
AlignConsecutiveAssignments: None
|
||||||
|
AlignConsecutiveBitFields: None
|
||||||
|
AlignConsecutiveDeclarations: None
|
||||||
|
AlignConsecutiveMacros: None
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Always
|
||||||
|
OverEmptyLines: 0
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
BreakAfterAttributes: Never
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakArrays: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: false
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 0
|
||||||
|
CommentPragmas: "^ IWYU pragma:"
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: ^(<|"(gtest|gmock|isl|json)/)
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: .*
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: (Test)?$
|
||||||
|
IncludeIsMainSourceRegex: ""
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
IntegerLiteralSeparator:
|
||||||
|
Binary: 0
|
||||||
|
BinaryMinDigits: 0
|
||||||
|
Decimal: 0
|
||||||
|
DecimalMinDigits: 0
|
||||||
|
Hex: 0
|
||||||
|
HexMinDigits: 0
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
Language: Cpp
|
||||||
|
LineEnding: DeriveLF
|
||||||
|
MacroBlockBegin: ""
|
||||||
|
MacroBlockEnd: ""
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PPIndentWidth: -1
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||||
|
PointerAlignment: Right
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RemoveSemicolon: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
RequiresExpressionIndentation: OuterScope
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: LexicographicNumeric
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: Never
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterIfMacros: false
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Latest
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Always
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- STRINGIZE
|
||||||
|
UseCRLF: false
|
||||||
2
.clangd
2
.clangd
|
|
@ -1,2 +1,2 @@
|
||||||
CompileFlags:
|
CompileFlags:
|
||||||
Add: [ -Wall, --std=c23, -xc, -Ivendor/ ]
|
Add: [ -Wall, --std=c++23, -xc++, -Ivendor/ ]
|
||||||
|
|
|
||||||
4
.dir-locals.el
Normal file
4
.dir-locals.el
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
((nil
|
||||||
|
(indent-tabs-mode . t)
|
||||||
|
(tab-width . 4)
|
||||||
|
(lsp-enable-on-type-formatting nil)))
|
||||||
2
justfile
2
justfile
|
|
@ -1,6 +1,6 @@
|
||||||
build:
|
build:
|
||||||
# BUILDING
|
# BUILDING
|
||||||
make
|
bear -- make
|
||||||
|
|
||||||
run:
|
run:
|
||||||
bin/DiceGui
|
bin/DiceGui
|
||||||
|
|
|
||||||
11
premake5.lua
11
premake5.lua
|
|
@ -4,15 +4,18 @@ workspace "DiceGui"
|
||||||
|
|
||||||
project "Dice"
|
project "Dice"
|
||||||
kind "ConsoleApp"
|
kind "ConsoleApp"
|
||||||
language "C"
|
language "C++"
|
||||||
cdialect "c23"
|
cppdialect "c++23"
|
||||||
location "build/"
|
location "build/"
|
||||||
files { "src/**.c" }
|
files { "src/**.cpp", "src/**.c" }
|
||||||
includedirs { "include/" }
|
includedirs { "include/" }
|
||||||
links { "m", "stdc++", "SDL3", "SDL3_ttf", "SDL3_image" }
|
links { "m", "stdc++", "SDL3", "SDL3_ttf", "SDL3_image" }
|
||||||
buildoptions { "-Wall" }
|
buildoptions { "-Wall" }
|
||||||
targetdir "bin/"
|
targetdir "bin/"
|
||||||
postbuildcommands { "{RMDIR} %{cfg.targetdir}/assets", "{COPYDIR} %{wks.location}/assets/ %{cfg.targetdir}/assets/" }
|
postbuildcommands {
|
||||||
|
"{RMDIR} %{cfg.targetdir}/assets",
|
||||||
|
"{COPYDIR} %{wks.location}/assets/ %{cfg.targetdir}/assets/"
|
||||||
|
}
|
||||||
filter "configurations:debug"
|
filter "configurations:debug"
|
||||||
defines { "DEBUG" }
|
defines { "DEBUG" }
|
||||||
symbols "On"
|
symbols "On"
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
#include "application.h"
|
|
||||||
#include "dice_container.h"
|
|
||||||
#include "style.h"
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#include <clay/clay.h>
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void DiceLogContainer() {
|
|
||||||
CLAY(CLAY_ID("LogContainer"), {
|
|
||||||
.layout = {
|
|
||||||
.sizing = layoutExpand,
|
|
||||||
.padding = CLAY_PADDING_ALL(16),
|
|
||||||
},
|
|
||||||
.PANEL(0),
|
|
||||||
}) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void InitiativeListContainer() {
|
|
||||||
CLAY(CLAY_ID("InitiativeListContainer"), {
|
|
||||||
.layout = {
|
|
||||||
.sizing = layoutExpand,
|
|
||||||
.padding = CLAY_PADDING_ALL(16),
|
|
||||||
},
|
|
||||||
.PANEL(0)
|
|
||||||
}) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleEvent(SDL_Event event) {
|
|
||||||
}
|
|
||||||
16
src/application.cpp
Normal file
16
src/application.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include "application.h"
|
||||||
|
#include "dice_container.h"
|
||||||
|
#include "style.h"
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
#include <clay/clay.h>
|
||||||
|
|
||||||
|
Clay_RenderCommandArray RenderApplication() {
|
||||||
|
Clay_BeginLayout();
|
||||||
|
CLAY(CLAY_ID("OuterContainer"), WindowStyle()) {
|
||||||
|
DiceContainer();
|
||||||
|
}
|
||||||
|
return Clay_EndLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleEvent(SDL_Event event) {
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
#include "dice.h"
|
#include "dice.h"
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
static int activeDiceCount = 0;
|
static size_t activeDiceCount = 0;
|
||||||
static enum Dice_Die activeDice[MAX_ACTIVE_DICE];
|
static enum Dice_Die activeDice[MAX_ACTIVE_DICE];
|
||||||
|
|
||||||
static struct Dice_ResultType rollResult[MAX_ACTIVE_DICE];
|
static struct Dice_ResultType rollResult[MAX_ACTIVE_DICE];
|
||||||
static struct Dice_ResultType rollTotal = {
|
|
||||||
.string = "0",
|
|
||||||
.roll = 0, .string_len = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
int Dice_Roll(enum Dice_Die die) {
|
int Dice_Roll(enum Dice_Die die) {
|
||||||
if (die == COIN) {
|
if (die == COIN) {
|
||||||
|
|
@ -23,16 +19,7 @@ static
|
||||||
struct Dice_ResultType Dice_RollToResultType(int roll, enum Dice_Die die) {
|
struct Dice_ResultType Dice_RollToResultType(int roll, enum Dice_Die die) {
|
||||||
struct Dice_ResultType result = { };
|
struct Dice_ResultType result = { };
|
||||||
result.roll = roll;
|
result.roll = roll;
|
||||||
if (die == COIN) {
|
result.die = die;
|
||||||
result.string_len = SDL_snprintf(result.string, MAX_ROLL_STR_LEN, roll == 1 ? "H" : "T");
|
|
||||||
} else {
|
|
||||||
result.string_len = SDL_snprintf(result.string, MAX_ROLL_STR_LEN, "%d", roll);
|
|
||||||
}
|
|
||||||
result.clay_string = (Clay_String) {
|
|
||||||
.chars = result.string,
|
|
||||||
.length = result.string_len,
|
|
||||||
.isStaticallyAllocated = false
|
|
||||||
};
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,34 +36,26 @@ size_t Dice_AddToActiveSet(enum Dice_Die die) {
|
||||||
}
|
}
|
||||||
activeDice[activeDiceCount] = die;
|
activeDice[activeDiceCount] = die;
|
||||||
rollResult[activeDiceCount] = Dice_RollToResultType(die, die);
|
rollResult[activeDiceCount] = Dice_RollToResultType(die, die);
|
||||||
rollTotal.roll += die;
|
|
||||||
rollTotal = Dice_RollToResultType(rollTotal.roll, 0);
|
|
||||||
return activeDiceCount++;
|
return activeDiceCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dice_RemoveFromActiveSet(size_t index) {
|
void Dice_RemoveFromActiveSet(size_t index) {
|
||||||
if (index >= MAX_ACTIVE_DICE) {
|
if (index >= MAX_ACTIVE_DICE) {
|
||||||
return;
|
return;
|
||||||
|
} else for (size_t i = index; i < activeDiceCount; ++i) {
|
||||||
|
rollResult[i] = rollResult[i+1];
|
||||||
}
|
}
|
||||||
rollTotal.roll -= rollResult[index].roll;
|
|
||||||
rollTotal = Dice_RollToResultType(rollTotal.roll, 0);
|
|
||||||
memcpy(activeDice + index, activeDice + index + 1, MAX_ACTIVE_DICE - index - 1);
|
|
||||||
--activeDiceCount;
|
--activeDiceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dice_ClearActiveSet() {
|
void Dice_ClearActiveSet() {
|
||||||
rollTotal.roll = 0;
|
|
||||||
rollTotal = Dice_RollToResultType(rollTotal.roll, 0);
|
|
||||||
activeDiceCount = 0;
|
activeDiceCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dice_RollActiveSet() {
|
void Dice_RollActiveSet() {
|
||||||
int total = 0;
|
|
||||||
for (size_t i = 0; i < activeDiceCount; ++i) {
|
for (size_t i = 0; i < activeDiceCount; ++i) {
|
||||||
rollResult[i] = Dice_RollToResultType(Dice_Roll(activeDice[i]), activeDice[i]);
|
rollResult[i] = Dice_RollToResultType(Dice_Roll(activeDice[i]), activeDice[i]);
|
||||||
total += rollResult[i].roll;
|
|
||||||
}
|
}
|
||||||
rollTotal = Dice_RollToResultType(total, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Dice_ResultType *Dice_GetLastResult(size_t *out_length) {
|
struct Dice_ResultType *Dice_GetLastResult(size_t *out_length) {
|
||||||
|
|
@ -86,17 +65,17 @@ struct Dice_ResultType *Dice_GetLastResult(size_t *out_length) {
|
||||||
return rollResult;
|
return rollResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Dice_ResultType *Dice_GetLastResultTotal() {
|
int Dice_GetLastResultTotal() {
|
||||||
rollTotal.clay_string = (Clay_String) {
|
int result = 0;
|
||||||
.chars = rollTotal.string,
|
for (size_t i = 0; i < activeDiceCount; ++i) {
|
||||||
.length = rollTotal.string_len,
|
result += rollResult[i].roll;
|
||||||
.isStaticallyAllocated = false
|
}
|
||||||
};
|
return result;
|
||||||
return &rollTotal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Clay_String Dice_ToString(enum Dice_Die die) {
|
Clay_String Dice_ToString(enum Dice_Die die) {
|
||||||
switch (die) {
|
switch (die) {
|
||||||
|
case NONE: return CLAY_STRING("N/A");
|
||||||
case COIN: return CLAY_STRING("C");
|
case COIN: return CLAY_STRING("C");
|
||||||
case D4: return CLAY_STRING("4");
|
case D4: return CLAY_STRING("4");
|
||||||
case D6: return CLAY_STRING("6");
|
case D6: return CLAY_STRING("6");
|
||||||
|
|
@ -106,4 +85,19 @@ Clay_String Dice_ToString(enum Dice_Die die) {
|
||||||
case D20: return CLAY_STRING("20");
|
case D20: return CLAY_STRING("20");
|
||||||
case D100: return CLAY_STRING("100");
|
case D100: return CLAY_STRING("100");
|
||||||
}
|
}
|
||||||
|
return CLAY_STRING("INVALID");
|
||||||
|
}
|
||||||
|
|
||||||
|
Clay_String Dice_ResultToString(Dice_ResultType const &result) {
|
||||||
|
static char chars[MAX_ROLL_STR_LEN];
|
||||||
|
Clay_String string = {
|
||||||
|
false, 0, chars,
|
||||||
|
};
|
||||||
|
if (result.die == COIN) {
|
||||||
|
string.length = SDL_snprintf(chars, MAX_ROLL_STR_LEN, result.roll == 1 ? "H" : "T");
|
||||||
|
} else {
|
||||||
|
string.length = SDL_snprintf(chars, MAX_ROLL_STR_LEN, "%d", result.roll);
|
||||||
|
}
|
||||||
|
string.chars = chars;
|
||||||
|
return string;
|
||||||
}
|
}
|
||||||
11
src/dice.h
11
src/dice.h
|
|
@ -5,6 +5,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
enum Dice_Die {
|
enum Dice_Die {
|
||||||
|
NONE,
|
||||||
COIN = 1,
|
COIN = 1,
|
||||||
D4 = 4,
|
D4 = 4,
|
||||||
D6 = 6,
|
D6 = 6,
|
||||||
|
|
@ -20,9 +21,7 @@ enum Dice_Die {
|
||||||
#endif
|
#endif
|
||||||
struct Dice_ResultType {
|
struct Dice_ResultType {
|
||||||
int roll;
|
int roll;
|
||||||
size_t string_len;
|
enum Dice_Die die;
|
||||||
char string[MAX_ROLL_STR_LEN];
|
|
||||||
Clay_String clay_string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef MAX_ACTIVE_DICE
|
#ifndef MAX_ACTIVE_DICE
|
||||||
|
|
@ -32,15 +31,17 @@ struct Dice_ResultType {
|
||||||
extern int Dice_Roll(enum Dice_Die die);
|
extern int Dice_Roll(enum Dice_Die die);
|
||||||
|
|
||||||
extern enum Dice_Die const *Dice_GetActiveSet(size_t *out_length);
|
extern enum Dice_Die const *Dice_GetActiveSet(size_t *out_length);
|
||||||
extern size_t Dice_AddToActiveSet(enum Dice_Die die);
|
extern size_t Dice_AddToActiveSet(Dice_Die die);
|
||||||
extern void Dice_RemoveFromActiveSet(size_t index);
|
extern void Dice_RemoveFromActiveSet(size_t index);
|
||||||
extern void Dice_ClearActiveSet();
|
extern void Dice_ClearActiveSet();
|
||||||
|
extern Clay_String Dice_RollToString(Dice_ResultType &type);
|
||||||
|
|
||||||
extern struct Dice_ResultType *Dice_GetLastResult(size_t *out_length);
|
extern struct Dice_ResultType *Dice_GetLastResult(size_t *out_length);
|
||||||
extern struct Dice_ResultType *Dice_GetLastResultTotal();
|
extern int Dice_GetLastResultTotal();
|
||||||
|
|
||||||
extern void Dice_RollActiveSet();
|
extern void Dice_RollActiveSet();
|
||||||
|
|
||||||
extern Clay_String Dice_ToString(enum Dice_Die die);
|
extern Clay_String Dice_ToString(enum Dice_Die die);
|
||||||
|
extern Clay_String Dice_ResultToString(Dice_ResultType const &result);
|
||||||
|
|
||||||
#endif // !DICE_H
|
#endif // !DICE_H
|
||||||
|
|
|
||||||
|
|
@ -1,174 +0,0 @@
|
||||||
#include "dice_container.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"
|
|
||||||
|
|
||||||
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) {
|
|
||||||
Dice_ClearActiveSet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
CLAY(CLAY_IDI("AddDieButton", die), {
|
|
||||||
.layout = {
|
|
||||||
.sizing = { CLAY_SIZING_FIXED(100), CLAY_SIZING_FIXED(100) },
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
},
|
|
||||||
.image = { GetDiceImage(die, Clay_Hovered()) },
|
|
||||||
.border = {
|
|
||||||
PanelBorder(0),
|
|
||||||
CLAY_BORDER_ALL(1),
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
Clay_OnHover(&HandleAddDieButtonInteraction, die);
|
|
||||||
CLAY_TEXT(Dice_ToString(die), CLAY_TEXT_CONFIG({
|
|
||||||
.H(2),
|
|
||||||
.textColor = TextColors(0),
|
|
||||||
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void DiceSelectorContainer() {
|
|
||||||
CLAY(CLAY_ID("DiceSelector"), {
|
|
||||||
.PANEL(0),
|
|
||||||
.layout = {
|
|
||||||
.sizing = { CLAY_SIZING_FIT(), CLAY_SIZING_GROW() },
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
},
|
|
||||||
}) {
|
|
||||||
CLAY(CLAY_ID("DiceSelectorInner"), {
|
|
||||||
.layout = {
|
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
.sizing = { CLAY_SIZING_FIT(), CLAY_SIZING_FIT() },
|
|
||||||
.padding = { 2, 2, 5, 5 },
|
|
||||||
},
|
|
||||||
.clip = {
|
|
||||||
true, true, Clay_GetScrollOffset(),
|
|
||||||
},
|
|
||||||
}) {
|
|
||||||
AddDieButton(D4);
|
|
||||||
AddDieButton(D6);
|
|
||||||
AddDieButton(D8);
|
|
||||||
AddDieButton(D10);
|
|
||||||
AddDieButton(D12);
|
|
||||||
AddDieButton(D20);
|
|
||||||
AddDieButton(D100);
|
|
||||||
AddDieButton(COIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
void HandleRemoveDieButtonInteraction(Clay_ElementId element, Clay_PointerData pointer, intptr_t index) {
|
|
||||||
if (pointer.state == CLAY_POINTER_DATA_PRESSED_THIS_FRAME) {
|
|
||||||
Dice_RemoveFromActiveSet(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void RemoveDieButton(enum Dice_Die die, int 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()) },
|
|
||||||
}) {
|
|
||||||
size_t result_length;
|
|
||||||
struct Dice_ResultType const *result = Dice_GetLastResult(&result_length);
|
|
||||||
Clay_String string = {
|
|
||||||
.chars = result[index].string,
|
|
||||||
.length = result[index].string_len,
|
|
||||||
.isStaticallyAllocated = true
|
|
||||||
};
|
|
||||||
Clay_OnHover(&HandleRemoveDieButtonInteraction, index);
|
|
||||||
CLAY_TEXT(string, CLAY_TEXT_CONFIG({
|
|
||||||
.H(1),
|
|
||||||
.textColor = TextColors(0),
|
|
||||||
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
void ActiveDiceContainer() {
|
|
||||||
CLAY(CLAY_ID("ActiveDice"), {
|
|
||||||
.layout = {
|
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_GROW() },
|
|
||||||
},
|
|
||||||
.PANEL(0),
|
|
||||||
}) {
|
|
||||||
CLAY(CLAY_ID("ActiveDiceInner"), {
|
|
||||||
.layout = {
|
|
||||||
.sizing = { CLAY_SIZING_FIT(), CLAY_SIZING_GROW() },
|
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_LEFT, CLAY_ALIGN_Y_CENTER },
|
|
||||||
.childGap = 16,
|
|
||||||
.padding = { 100, 100, 0, 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) {
|
|
||||||
RemoveDieButton(dice[i], i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CLAY(CLAY_ID("ActiveDiceControls"), {
|
|
||||||
.layout = {
|
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
.childGap = 20,
|
|
||||||
.padding = { 0, 0, 0, 10 },
|
|
||||||
},
|
|
||||||
}) {
|
|
||||||
TextButton(CLAY_STRING("Roll"), proceedButton, &HandleRollSetButtonInteraction, 0);
|
|
||||||
CLAY_TEXT(Dice_GetLastResultTotal()->clay_string, CLAY_TEXT_CONFIG({
|
|
||||||
.H(3),
|
|
||||||
.textColor = TextColors(0),
|
|
||||||
}));
|
|
||||||
TextButton(CLAY_STRING("Clear"), warningButton, &HandleClearSetButtonInteraction, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DiceContainer() {
|
|
||||||
CLAY(CLAY_ID("DiceContainer"), {
|
|
||||||
.layout = {
|
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
|
||||||
.sizing = { CLAY_SIZING_GROW(), CLAY_SIZING_PERCENT(0.4) },
|
|
||||||
.childGap = containerGap
|
|
||||||
},
|
|
||||||
}) {
|
|
||||||
DiceSelectorContainer();
|
|
||||||
ActiveDiceContainer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
161
src/dice_container.cpp
Normal file
161
src/dice_container.cpp
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
#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>
|
||||||
|
|
||||||
|
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) {
|
||||||
|
Dice_ClearActiveSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
CLAY(CLAY_IDI("AddDieButton", die), {
|
||||||
|
.layout = {
|
||||||
|
.sizing = {CLAY_SIZING_FIXED(100), CLAY_SIZING_FIXED(100)},
|
||||||
|
.childAlignment = {CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER},
|
||||||
|
},
|
||||||
|
.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})));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void DiceSelectorContainer() {
|
||||||
|
CLAY(CLAY_ID("DiceSelector"),
|
||||||
|
PanelContainer(0, (Clay_ElementDeclaration){
|
||||||
|
.layout = {
|
||||||
|
.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,
|
||||||
|
},
|
||||||
|
.clip = {
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
Clay_GetScrollOffset(),
|
||||||
|
},
|
||||||
|
})) {
|
||||||
|
AddDieButton(D4);
|
||||||
|
AddDieButton(D6);
|
||||||
|
AddDieButton(D8);
|
||||||
|
AddDieButton(D10);
|
||||||
|
AddDieButton(D12);
|
||||||
|
AddDieButton(D20);
|
||||||
|
AddDieButton(D100);
|
||||||
|
AddDieButton(COIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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())},
|
||||||
|
}) {
|
||||||
|
Clay_OnHover(&HandleRemoveDieButtonInteraction, (intptr_t)index);
|
||||||
|
size_t result_length;
|
||||||
|
struct Dice_ResultType const *result = Dice_GetLastResult(&result_length);
|
||||||
|
CLAY_TEXT(
|
||||||
|
UiData_StoreClayStr(Dice_ResultToString(result[index])),
|
||||||
|
CLAY_TEXT_CONFIG(Header(1, {
|
||||||
|
.textColor = TextColors(0),
|
||||||
|
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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},
|
||||||
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
|
},
|
||||||
|
})) {
|
||||||
|
CLAY(CLAY_ID("ActiveDiceInner"), {
|
||||||
|
.layout = {
|
||||||
|
.sizing = {CLAY_SIZING_FIT(), CLAY_SIZING_GROW()},
|
||||||
|
.padding = {100, 100, 0, 0},
|
||||||
|
.childGap = 16,
|
||||||
|
.childAlignment = {CLAY_ALIGN_X_LEFT, CLAY_ALIGN_Y_CENTER},
|
||||||
|
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||||
|
},
|
||||||
|
.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) {
|
||||||
|
RemoveDieButton(dice[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CLAY(CLAY_ID("ActiveDiceControls"), {
|
||||||
|
.layout = {
|
||||||
|
.padding = {0, 0, 0, 10},
|
||||||
|
.childGap = 20,
|
||||||
|
.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)
|
||||||
|
})));
|
||||||
|
TextButton(CLAY_STRING("Clear"), warningButton, &HandleClearSetButtonInteraction, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiceContainer() {
|
||||||
|
CLAY(CLAY_ID("DiceContainer"), {
|
||||||
|
.layout = {
|
||||||
|
.sizing = {CLAY_SIZING_GROW(), CLAY_SIZING_GROW()},
|
||||||
|
.childGap = containerGap,
|
||||||
|
.layoutDirection = CLAY_LEFT_TO_RIGHT,
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
DiceSelectorContainer();
|
||||||
|
ActiveDiceContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,18 +5,17 @@ void TextButton(Clay_String text, Clay_Color color, OnHoveredFn onHovered, intpt
|
||||||
Clay_Color hovered = ToHoveredColor(color);
|
Clay_Color hovered = ToHoveredColor(color);
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
|
||||||
.padding = buttonPadding,
|
.padding = buttonPadding,
|
||||||
|
.childAlignment = { CLAY_ALIGN_X_CENTER, CLAY_ALIGN_Y_CENTER },
|
||||||
},
|
},
|
||||||
.cornerRadius = buttonRadii,
|
|
||||||
.backgroundColor = Clay_Hovered() ? hovered : color,
|
.backgroundColor = Clay_Hovered() ? hovered : color,
|
||||||
.border = { ToHoveredColor(Clay_Hovered() ? hovered : color), CLAY_BORDER_ALL(1) }
|
.cornerRadius = buttonRadii,
|
||||||
|
.border = { ToHoveredColor(Clay_Hovered() ? hovered : color), CLAY_BORDER_ALL(1) },
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(text, CLAY_TEXT_CONFIG(BodyText({
|
||||||
.BODY(),
|
|
||||||
.textColor = TextColors(0),
|
.textColor = TextColors(0),
|
||||||
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
|
.textAlignment = CLAY_TEXT_ALIGN_CENTER,
|
||||||
}));
|
})));
|
||||||
Clay_OnHover(onHovered, onHoveredData);
|
Clay_OnHover(onHovered, onHoveredData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
|
#include "renderer/clay_renderer_SDL3.h"
|
||||||
#include <SDL3/SDL_hints.h>
|
#include <SDL3/SDL_hints.h>
|
||||||
#include <SDL3/SDL_keycode.h>
|
#include <SDL3/SDL_keycode.h>
|
||||||
#include <SDL3/SDL_oldnames.h>
|
#include <SDL3/SDL_oldnames.h>
|
||||||
#include <clay/clay.h>
|
#include <clay/clay.h>
|
||||||
#include "renderer/clay_renderer_SDL3.h"
|
|
||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "style.h"
|
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
|
#include "ui_data.h"
|
||||||
|
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
@ -20,86 +20,84 @@
|
||||||
#include <SDL3/SDL_video.h>
|
#include <SDL3/SDL_video.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
constexpr SDL_InitFlags sdlInitFlags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
constexpr SDL_InitFlags sdlInitFlags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
||||||
|
|
||||||
SDL_Window *window = nullptr;
|
SDL_Window *window = nullptr;
|
||||||
SDL_Renderer *renderer = nullptr;
|
SDL_Renderer *renderer = nullptr;
|
||||||
int screenWidth = 1920, screenHeight = 1080;
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
uint64_t clayMemorySize = 0;
|
uint64_t clayMemorySize = 0;
|
||||||
|
|
||||||
Clay_Arena clayPrimaryArena;
|
Clay_Arena clayPrimaryArena;
|
||||||
|
|
||||||
Clay_SDL3RendererData backendData = {
|
Clay_SDL3RendererData backendData = {nullptr, nullptr, nullptr};
|
||||||
.renderer = nullptr,
|
|
||||||
.fonts = nullptr,
|
|
||||||
.textEngine = nullptr
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
static inline void LogOutputResolution() {
|
||||||
void LogOutputResolution() {
|
|
||||||
int w, h;
|
int w, h;
|
||||||
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
||||||
SDL_Log("output size: %i, %d", w, h);
|
SDL_Log("output size: %i, %d", w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static Clay_Dimensions MeasureText(Clay_StringSlice text, Clay_TextElementConfig *config, void *userData) {
|
||||||
Clay_Dimensions MeasureText(Clay_StringSlice text, Clay_TextElementConfig *config, void *userData) {
|
TTF_Font **fonts = (TTF_Font **)userData;
|
||||||
TTF_Font **fonts = userData;
|
|
||||||
TTF_Font *font = fonts[config->fontId];
|
TTF_Font *font = fonts[config->fontId];
|
||||||
int width, height;
|
int width, height;
|
||||||
TTF_SetFontSize(font, config->fontSize);
|
TTF_SetFontSize(font, config->fontSize);
|
||||||
if (!TTF_GetStringSize(font, text.chars, text.length, &width, &height)) {
|
if(!TTF_GetStringSize(font, text.chars, text.length, &width, &height)) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "MeasureText failed to measure text %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "MeasureText failed to measure text %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
return (Clay_Dimensions) { width, height };
|
return (Clay_Dimensions){(float)width, (float)height};
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void HandleClayErrors(Clay_ErrorData data) {
|
||||||
void HandleClayErrors(Clay_ErrorData data) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", data.errorText.chars);
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "%s", data.errorText.chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline void InitSDL() {
|
||||||
void InitSDL() {
|
|
||||||
SDL_SetHint(SDL_HINT_RENDER_LINE_METHOD, "3");
|
SDL_SetHint(SDL_HINT_RENDER_LINE_METHOD, "3");
|
||||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
|
if(!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_Init failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_Init failed: %s", SDL_GetError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((window = SDL_CreateWindow("Window", screenWidth, screenHeight, sdlInitFlags)) == nullptr) {
|
int screenWidth{1920}, screenHeight{1080};
|
||||||
|
if(SDL_DisplayMode const *mode{SDL_GetDesktopDisplayMode(0)}) {
|
||||||
|
screenWidth = mode->w;
|
||||||
|
screenHeight = mode->h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((window = SDL_CreateWindow("Window", screenWidth, screenHeight, sdlInitFlags)) == nullptr) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_CreateWindow failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_CreateWindow failed: %s", SDL_GetError());
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
if ((renderer = SDL_CreateRenderer(window, NULL)) == nullptr) {
|
if((renderer = SDL_CreateRenderer(window, NULL)) == nullptr) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_CreateRenderer failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "SDL_CreateRenderer failed: %s", SDL_GetError());
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
if (!TTF_Init()) {
|
if(!TTF_Init()) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "TTF_Init failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "TTF_Init failed: %s", SDL_GetError());
|
||||||
exit(4);
|
exit(4);
|
||||||
}
|
}
|
||||||
if ((textEngine = TTF_CreateRendererTextEngine(renderer)) == nullptr) {
|
if((textEngine = TTF_CreateRendererTextEngine(renderer)) == nullptr) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "TTF_CreateRendererTextEngine failed: %s", SDL_GetError());
|
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "TTF_CreateRendererTextEngine failed: %s", SDL_GetError());
|
||||||
exit(5);
|
exit(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void InitClay() {
|
||||||
void InitClay() {
|
|
||||||
clayMemorySize = Clay_MinMemorySize();
|
clayMemorySize = Clay_MinMemorySize();
|
||||||
clayPrimaryArena = Clay_CreateArenaWithCapacityAndMemory(clayMemorySize, SDL_malloc(clayMemorySize));
|
clayPrimaryArena = Clay_CreateArenaWithCapacityAndMemory(clayMemorySize, SDL_malloc(clayMemorySize));
|
||||||
Clay_Initialize(clayPrimaryArena, (Clay_Dimensions) { screenWidth, screenHeight }, (Clay_ErrorHandler) { HandleClayErrors });
|
int screenWidth{}, screenHeight{};
|
||||||
|
SDL_GetCurrentRenderOutputSize(renderer, &screenWidth, &screenHeight);
|
||||||
|
Clay_Initialize(clayPrimaryArena, {(float)screenWidth, (float)screenHeight}, {HandleClayErrors});
|
||||||
Clay_SetMeasureTextFunction(MeasureText, fonts);
|
Clay_SetMeasureTextFunction(MeasureText, fonts);
|
||||||
Clay_SetLayoutDimensions((Clay_Dimensions) { screenWidth, screenHeight });
|
Clay_SetLayoutDimensions({(float)screenWidth, (float)screenHeight});
|
||||||
float x, y;
|
float x, y;
|
||||||
SDL_GetMouseState(&x, &y);
|
SDL_GetMouseState(&x, &y);
|
||||||
Clay_SetPointerState((Clay_Vector2) { x, y }, false);
|
Clay_SetPointerState((Clay_Vector2){x, y}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern Clay_RenderCommandArray RenderApplication();
|
extern Clay_RenderCommandArray RenderApplication();
|
||||||
|
|
@ -110,57 +108,52 @@ int main(int argc, char *argv[]) {
|
||||||
LoadResources();
|
LoadResources();
|
||||||
LogOutputResolution();
|
LogOutputResolution();
|
||||||
InitClay();
|
InitClay();
|
||||||
backendData = (Clay_SDL3RendererData) {
|
backendData = (Clay_SDL3RendererData){renderer, textEngine, fonts};
|
||||||
.renderer = renderer,
|
|
||||||
.fonts = fonts,
|
|
||||||
.textEngine = textEngine,
|
|
||||||
};
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
uint64_t startFrameTime = SDL_GetTicksNS();
|
uint64_t startFrameTime = SDL_GetTicksNS();
|
||||||
double deltaTime = 0.0;
|
double deltaTime = 0.0;
|
||||||
bool mouseButtonDown = false;
|
bool mouseButtonDown = false;
|
||||||
bool shiftDown = false;
|
bool shiftDown = false;
|
||||||
while (running) {
|
while(running) {
|
||||||
deltaTime = SDL_GetTicksNS() - startFrameTime;
|
deltaTime = SDL_GetTicksNS() - startFrameTime;
|
||||||
startFrameTime = SDL_GetTicksNS();
|
startFrameTime = SDL_GetTicksNS();
|
||||||
Clay_Vector2 scrollMotion = { 0, 0 };
|
Clay_Vector2 scrollMotion = {0, 0};
|
||||||
while (SDL_PollEvent(&event)) {
|
UiData_Clear();
|
||||||
|
while(SDL_PollEvent(&event)) {
|
||||||
HandleEvent(event);
|
HandleEvent(event);
|
||||||
switch (event.type) {
|
switch(event.type) {
|
||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
running = false;
|
running = false;
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_WINDOW_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
Clay_SetLayoutDimensions((Clay_Dimensions){
|
Clay_SetLayoutDimensions({(float)event.window.data1, (float)event.window.data2});
|
||||||
event.window.data1,
|
LogOutputResolution();
|
||||||
event.window.data2
|
break;
|
||||||
});
|
case SDL_EVENT_MOUSE_WHEEL:
|
||||||
LogOutputResolution();
|
if(shiftDown) {
|
||||||
break;
|
scrollMotion = (Clay_Vector2){event.wheel.y * 2.f, -event.wheel.x * 5.f};
|
||||||
case SDL_EVENT_MOUSE_WHEEL:
|
} else {
|
||||||
if (shiftDown) {
|
scrollMotion = (Clay_Vector2){-event.wheel.x * 2.f, event.wheel.y * 5.f};
|
||||||
scrollMotion = (Clay_Vector2) { event.wheel.y * 2.f, -event.wheel.x * 5.f };
|
}
|
||||||
} else {
|
break;
|
||||||
scrollMotion = (Clay_Vector2) { -event.wheel.x * 2.f, event.wheel.y * 5.f };
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
}
|
Clay_SetPointerState((Clay_Vector2){event.motion.x, event.motion.y}, mouseButtonDown);
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_MOUSE_MOTION:
|
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||||
Clay_SetPointerState((Clay_Vector2) { event.motion.x, event.motion.y }, mouseButtonDown);
|
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||||
break;
|
if(event.button.button == SDL_BUTTON_LEFT) {
|
||||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
mouseButtonDown = event.button.down;
|
||||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
Clay_SetPointerState((Clay_Vector2){event.button.x, event.button.y}, mouseButtonDown);
|
||||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
}
|
||||||
mouseButtonDown = event.button.down;
|
break;
|
||||||
Clay_SetPointerState((Clay_Vector2) { event.button.x, event.button.y }, mouseButtonDown);
|
case SDL_EVENT_KEY_DOWN:
|
||||||
}
|
case SDL_EVENT_KEY_UP:
|
||||||
break;
|
if(event.key.key == SDLK_LSHIFT || event.key.key == SDLK_RSHIFT) {
|
||||||
case SDL_EVENT_KEY_DOWN:
|
shiftDown = event.key.down;
|
||||||
case SDL_EVENT_KEY_UP:
|
}
|
||||||
if (event.key.key == SDLK_LSHIFT || event.key.key == SDLK_RSHIFT) {
|
break;
|
||||||
shiftDown = event.key.down;
|
default:
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Clay_UpdateScrollContainers(true, scrollMotion, deltaTime);
|
Clay_UpdateScrollContainers(true, scrollMotion, deltaTime);
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef CLAY_RENDERER_SDL3_H
|
#ifndef CLAY_RENDERER_SDL3_H
|
||||||
#define CLAY_RENDERER_SDL3_H
|
#define CLAY_RENDERER_SDL3_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
#include <clay/clay.h>
|
#include <clay/clay.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
#include <SDL3/SDL_render.h>
|
#include <SDL3/SDL_render.h>
|
||||||
|
|
@ -12,5 +15,8 @@ typedef struct {
|
||||||
} Clay_SDL3RendererData;
|
} Clay_SDL3RendererData;
|
||||||
|
|
||||||
extern void SDL_Clay_RenderClayCommands(Clay_SDL3RendererData *rendererData, Clay_RenderCommandArray *rcommands);
|
extern void SDL_Clay_RenderClayCommands(Clay_SDL3RendererData *rendererData, Clay_RenderCommandArray *rcommands);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // !CLAY_RENDERER_SDL3_H
|
#endif // !CLAY_RENDERER_SDL3_H
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ void LoadResources() {
|
||||||
|
|
||||||
SDL_Texture *GetDiceImage(enum Dice_Die die, bool selected) {
|
SDL_Texture *GetDiceImage(enum Dice_Die die, bool selected) {
|
||||||
switch (die) {
|
switch (die) {
|
||||||
|
default:
|
||||||
case COIN:
|
case COIN:
|
||||||
return selected ? diceImagesSelected[COIN_IMAGE] : diceImages[COIN_IMAGE];
|
return selected ? diceImagesSelected[COIN_IMAGE] : diceImages[COIN_IMAGE];
|
||||||
case D4:
|
case D4:
|
||||||
|
|
@ -1,6 +1,26 @@
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "dice.h"
|
#include "dice.h"
|
||||||
|
#include <clay/clay.h>
|
||||||
|
|
||||||
|
Clay_ElementDeclaration ListContainer(size_t depth, Clay_ElementDeclaration source) {
|
||||||
|
source.border = (Clay_BorderElementConfig) {
|
||||||
|
PanelBorder(depth),
|
||||||
|
CLAY_BORDER_ALL(2)
|
||||||
|
};
|
||||||
|
source.cornerRadius = defaultRadiusAll;
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
Clay_ElementDeclaration PanelContainer(size_t depth, Clay_ElementDeclaration source) {
|
||||||
|
source.backgroundColor = PanelBackground(depth);
|
||||||
|
source.border = (Clay_BorderElementConfig) {
|
||||||
|
PanelBorder(depth),
|
||||||
|
CLAY_BORDER_OUTSIDE(2)
|
||||||
|
};
|
||||||
|
source.cornerRadius = defaultRadiusAll;
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
Clay_Color PanelBackground(size_t idx) {
|
Clay_Color PanelBackground(size_t idx) {
|
||||||
return (Clay_Color) {
|
return (Clay_Color) {
|
||||||
|
|
@ -11,6 +31,18 @@ Clay_Color PanelBackground(size_t idx) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clay_TextElementConfig BodyText(Clay_TextElementConfig base) {
|
||||||
|
base.fontId = FONT_DEFAULT;
|
||||||
|
base.fontSize = baseFontSize;
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
Clay_TextElementConfig Header(size_t header, Clay_TextElementConfig base) {
|
||||||
|
base.fontId = FONT_BOLD;
|
||||||
|
base.fontSize = headerSizes[(header)-1];
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
Clay_Color PanelBorder(size_t idx) {
|
Clay_Color PanelBorder(size_t idx) {
|
||||||
return (Clay_Color) {
|
return (Clay_Color) {
|
||||||
255*panelBorder[idx],
|
255*panelBorder[idx],
|
||||||
|
|
@ -41,10 +73,10 @@ Clay_Color WindowBackground() {
|
||||||
Clay_ElementDeclaration WindowStyle() {
|
Clay_ElementDeclaration WindowStyle() {
|
||||||
return (Clay_ElementDeclaration) {
|
return (Clay_ElementDeclaration) {
|
||||||
.layout = {
|
.layout = {
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
|
||||||
.sizing = layoutExpand,
|
.sizing = layoutExpand,
|
||||||
.padding = CLAY_PADDING_ALL(windowPadding),
|
.padding = CLAY_PADDING_ALL(windowPadding),
|
||||||
.childGap = containerGap,
|
.childGap = containerGap,
|
||||||
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
},
|
},
|
||||||
.backgroundColor = WindowBackground()
|
.backgroundColor = WindowBackground()
|
||||||
};
|
};
|
||||||
15
src/style.h
15
src/style.h
|
|
@ -36,10 +36,8 @@ constexpr Clay_Padding panelPadding = {
|
||||||
24, 24,
|
24, 24,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PANEL(depth_)\
|
extern Clay_ElementDeclaration ListContainer(size_t depth, Clay_ElementDeclaration source);
|
||||||
backgroundColor = PanelBackground(depth_),\
|
extern Clay_ElementDeclaration PanelContainer(size_t depth, Clay_ElementDeclaration source);
|
||||||
.border = { PanelBackground(depth_), CLAY_BORDER_ALL(2) },\
|
|
||||||
.cornerRadius = defaultRadiusAll
|
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// TEXT STYLE
|
// TEXT STYLE
|
||||||
|
|
@ -58,13 +56,8 @@ constexpr uint16_t headerSizes[] = {
|
||||||
28, 16
|
28, 16
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BODY()\
|
extern Clay_TextElementConfig BodyText(Clay_TextElementConfig base);
|
||||||
fontId = FONT_DEFAULT,\
|
extern Clay_TextElementConfig Header(size_t header, Clay_TextElementConfig base);
|
||||||
.fontSize = baseFontSize
|
|
||||||
|
|
||||||
#define H(level_)\
|
|
||||||
fontId = FONT_BOLD,\
|
|
||||||
.fontSize = headerSizes[(level_)-1]
|
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// BUTTONS
|
// BUTTONS
|
||||||
|
|
|
||||||
30
src/ui_data.c
Normal file
30
src/ui_data.c
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include "ui_data.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
constexpr size_t uiDataLength = UI_DATA_SIZE;
|
||||||
|
|
||||||
|
static size_t utilized = 9;
|
||||||
|
static char uiDataArena[uiDataLength];
|
||||||
|
static char *uiDataWriter = uiDataArena;
|
||||||
|
|
||||||
|
Clay_String UiData_StoreString(char const *data, size_t amount) {
|
||||||
|
if (utilized + amount > uiDataLength) {
|
||||||
|
return CLAY_STRING("out of arena memory");
|
||||||
|
}
|
||||||
|
memcpy(uiDataWriter, data, amount);
|
||||||
|
Clay_String result = {
|
||||||
|
false, (int32_t)amount, uiDataWriter
|
||||||
|
};
|
||||||
|
uiDataWriter += amount;
|
||||||
|
utilized += amount;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Clay_String UiData_StoreClayStr(Clay_String string) {
|
||||||
|
return UiData_StoreString(string.chars, string.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UiData_Clear() {
|
||||||
|
utilized = 0;
|
||||||
|
uiDataWriter = uiDataArena;
|
||||||
|
}
|
||||||
23
src/ui_data.h
Normal file
23
src/ui_data.h
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef UI_DATA_H
|
||||||
|
#define UI_DATA_H
|
||||||
|
|
||||||
|
#include <clay/clay.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef UI_DATA_SIZE
|
||||||
|
#define UI_DATA_SIZE 1024*1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern Clay_String UiData_StoreString(char const *data, size_t amount);
|
||||||
|
extern Clay_String UiData_StoreClayStr(Clay_String str);
|
||||||
|
extern void UiData_Clear();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // !UI_DATA_
|
||||||
Loading…
Reference in a new issue