Skip to content

Commit 344d5d0

Browse files
committed
refactor: add clang format, and fix some bugs
1 parent 582bbb3 commit 344d5d0

28 files changed

+2585
-2875
lines changed

.clang-format

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
BasedOnStyle: LLVM
3+
BreakBeforeBraces: Custom
4+
BraceWrapping:
5+
AfterCaseLabel: true
6+
AfterClass: true
7+
AfterControlStatement: Never
8+
AfterEnum: true
9+
AfterFunction: true
10+
AfterNamespace: true
11+
AfterStruct: true
12+
AfterUnion: true
13+
AfterExternBlock: true
14+
BeforeCatch: false
15+
BeforeElse: false
16+
BeforeLambdaBody: true
17+
BeforeWhile: false
18+
IndentBraces: false
19+
SplitEmptyFunction: true
20+
SplitEmptyRecord: true
21+
SplitEmptyNamespace: true
22+
IndentWidth: 4
23+
TabWidth: 4
24+
UseTab: Never
25+
ContinuationIndentWidth: 4
26+
IndentCaseLabels: true
27+
IndentCaseBlocks: false
28+
IndentGotoLabels: true
29+
IndentPPDirectives: None
30+
IndentExternBlock: AfterExternBlock
31+
IndentRequiresClause: true
32+
IndentWrappedFunctionNames: false
33+
AlignAfterOpenBracket: Align
34+
AlignArrayOfStructures: Left
35+
AlignConsecutiveAssignments: None
36+
AlignConsecutiveBitFields: None
37+
AlignConsecutiveDeclarations: None
38+
AlignConsecutiveMacros: None
39+
AlignEscapedNewlines: Right
40+
AlignOperands: Align
41+
AlignTrailingComments: true
42+
AllowAllArgumentsOnNextLine: true
43+
AllowAllParametersOfDeclarationOnNextLine: true
44+
AllowShortBlocksOnASingleLine: Never
45+
AllowShortCaseLabelsOnASingleLine: false
46+
AllowShortEnumsOnASingleLine: false
47+
AllowShortFunctionsOnASingleLine: None
48+
AllowShortIfStatementsOnASingleLine: Never
49+
AllowShortLambdasOnASingleLine: All
50+
AllowShortLoopsOnASingleLine: false
51+
LambdaBodyIndentation: OuterScope
52+
AlwaysBreakAfterReturnType: None
53+
AlwaysBreakBeforeMultilineStrings: false
54+
AlwaysBreakTemplateDeclarations: MultiLine
55+
BinPackArguments: true
56+
BinPackParameters: true
57+
BreakBeforeBinaryOperators: None
58+
BreakBeforeConceptDeclarations: true
59+
BreakBeforeTernaryOperators: true
60+
BreakConstructorInitializers: BeforeColon
61+
BreakInheritanceList: BeforeColon
62+
BreakStringLiterals: true
63+
ColumnLimit: 180
64+
SpaceAfterCStyleCast: false
65+
SpaceAfterLogicalNot: false
66+
SpaceAfterTemplateKeyword: true
67+
SpaceAroundPointerQualifiers: Default
68+
SpaceBeforeAssignmentOperators: true
69+
SpaceBeforeCaseColon: false
70+
SpaceBeforeCpp11BracedList: false
71+
SpaceBeforeCtorInitializerColon: true
72+
SpaceBeforeInheritanceColon: true
73+
SpaceBeforeParens: ControlStatements
74+
SpaceBeforeParensOptions:
75+
AfterControlStatements: true
76+
AfterForeachMacros: true
77+
AfterFunctionDefinitionName: false
78+
AfterFunctionDeclarationName: false
79+
AfterIfMacros: true
80+
AfterOverloadedOperator: false
81+
BeforeNonEmptyParentheses: false
82+
SpaceBeforeRangeBasedForLoopColon: true
83+
SpaceBeforeSquareBrackets: false
84+
SpaceInEmptyBlock: false
85+
SpaceInEmptyParentheses: false
86+
SpacesBeforeTrailingComments: 1
87+
SpacesInAngles: Never
88+
SpacesInCStyleCastParentheses: false
89+
SpacesInConditionalStatement: false
90+
SpacesInContainerLiterals: true
91+
SpacesInParentheses: false
92+
SpacesInSquareBrackets: false
93+
Cpp11BracedListStyle: false
94+
DerivePointerAlignment: false
95+
PointerAlignment: Left
96+
ReferenceAlignment: Pointer
97+
FixNamespaceComments: true
98+
IncludeBlocks: Preserve
99+
InsertTrailingCommas: None
100+
KeepEmptyLinesAtTheStartOfBlocks: true
101+
MaxEmptyLinesToKeep: 1
102+
NamespaceIndentation: None
103+
SortIncludes: Never
104+
SortUsingDeclarations: true
105+
Language: Cpp
106+
Standard: Latest

CMakeUserPresets.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"binaryDir": "${sourceDir}/build/debug",
2323
"cacheVariables": {
2424
"CMAKE_BUILD_TYPE": "Debug",
25-
"VCPKG_TARGET_TRIPLET": "x86-mingw-static"
25+
"VCPKG_TARGET_TRIPLET": "x86-mingw-static",
26+
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
2627
}
2728
},
2829
{
@@ -32,8 +33,9 @@
3233
"binaryDir": "${sourceDir}/build/release",
3334
"cacheVariables": {
3435
"CMAKE_BUILD_TYPE": "Release",
35-
"VCPKG_TARGET_TRIPLET": "x86-mingw-static"
36+
"VCPKG_TARGET_TRIPLET": "x86-mingw-static",
37+
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
3638
}
3739
}
3840
]
39-
}
41+
}

include/animate.h

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/**
22
* ==================================================
3-
* _____ _ _ _ _
4-
* | |_| | |___ ___ ___|_|_ _ _____
5-
* | | | | | | | -_| | | | | | |
6-
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7-
*
3+
* _____ _ _ _ _
4+
* | |_| | |___ ___ ___|_|_ _ _____
5+
* | | | | | | | -_| | | | | | |
6+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7+
*
88
* ==================================================
9-
*
9+
*
1010
* Copyright (c) 2025 Project Millennium
11-
*
11+
*
1212
* Permission is hereby granted, free of charge, to any person obtaining a copy
1313
* of this software and associated documentation files (the "Software"), to deal
1414
* in the Software without restriction, including without limitation the rights
1515
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
* copies of the Software, and to permit persons to whom the Software is
1717
* furnished to do so, subject to the following conditions:
18-
*
18+
*
1919
* The above copyright notice and this permission notice shall be included in all
2020
* copies or substantial portions of the Software.
21-
*
21+
*
2222
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2323
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2424
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,27 +36,21 @@
3636

3737
// Easing function: ease-in-out quadratic
3838
float EaseInOut(float t);
39-
float EaseInOutTime(float t, float b, float c, float d) ;
39+
float EaseInOutTime(float t, float b, float c, float d);
4040

4141
struct AnimationState
4242
{
4343
float currentPosY;
4444
float startPosY;
45-
float elapsedTime;
46-
bool isAnimating;
47-
bool wasHovered;
45+
float elapsedTime;
46+
bool isAnimating;
47+
bool wasHovered;
4848

4949
float lastXDPI = XDPI, lastYDPI = YDPI;
5050
};
5151

52-
float SmoothFloat(
53-
const std::string& id,
54-
float targetOffset,
55-
bool currentState,
56-
float displacement,
57-
float duration,
58-
std::tuple<float, float> colorTransition = std::make_tuple(0.f, 0.f)
59-
);
52+
float SmoothFloat(const std::string& id, float targetOffset, bool currentState, float displacement, float duration,
53+
std::tuple<float, float> colorTransition = std::make_tuple(0.f, 0.f));
6054

6155
float EaseInOutFloat(const std::string& id, float lowerBound, float upperBound, bool currentState, float duration);
6256

include/components.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/**
22
* ==================================================
3-
* _____ _ _ _ _
4-
* | |_| | |___ ___ ___|_|_ _ _____
5-
* | | | | | | | -_| | | | | | |
6-
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7-
*
3+
* _____ _ _ _ _
4+
* | |_| | |___ ___ ___|_|_ _ _____
5+
* | | | | | | | -_| | | | | | |
6+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7+
*
88
* ==================================================
9-
*
9+
*
1010
* Copyright (c) 2025 Project Millennium
11-
*
11+
*
1212
* Permission is hereby granted, free of charge, to any person obtaining a copy
1313
* of this software and associated documentation files (the "Software"), to deal
1414
* in the Software without restriction, including without limitation the rights
1515
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
* copies of the Software, and to permit persons to whom the Software is
1717
* furnished to do so, subject to the following conditions:
18-
*
18+
*
1919
* The above copyright notice and this permission notice shall be included in all
2020
* copies or substantial portions of the Software.
21-
*
21+
*
2222
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2323
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2424
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -28,13 +28,13 @@
2828
* SOFTWARE.
2929
*/
3030

31-
#pragma once
31+
#pragma once
3232

3333
#include <memory>
3434
#include <router.h>
3535
#include <nlohmann/json.hpp>
3636

37-
bool RenderTitleBarComponent(std::shared_ptr<RouterNav> router);
37+
bool RenderTitleBarComponent(std::shared_ptr<RouterNav> router);
3838
const void RenderHome(std::shared_ptr<RouterNav> router, float xPos);
3939
const void RenderInstallPrompt(std::shared_ptr<RouterNav> router, float xPos);
4040
const void RenderInstaller(std::shared_ptr<RouterNav> router, float xPos);
@@ -46,7 +46,8 @@ void StartInstaller(std::string steamPath, nlohmann::json& releaseInfo, nlohmann
4646
void InitializeUninstaller();
4747
const bool FetchVersionInfo();
4848

49-
enum MessageLevel {
49+
enum MessageLevel
50+
{
5051
Error,
5152
Info,
5253
Warning
@@ -60,7 +61,8 @@ struct CheckBoxState
6061
bool isHovered;
6162
bool isChecked;
6263

63-
CheckBoxState(bool isChecked) : isHovered(false), isChecked(false) {
64+
CheckBoxState(bool isChecked) : isHovered(false), isChecked(false)
65+
{
6466
this->isChecked = isChecked;
6567
}
6668
};

include/dpi.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/**
22
* ==================================================
3-
* _____ _ _ _ _
4-
* | |_| | |___ ___ ___|_|_ _ _____
5-
* | | | | | | | -_| | | | | | |
6-
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7-
*
3+
* _____ _ _ _ _
4+
* | |_| | |___ ___ ___|_|_ _ _____
5+
* | | | | | | | -_| | | | | | |
6+
* |_|_|_|_|_|_|___|_|_|_|_|_|___|_|_|_|
7+
*
88
* ==================================================
9-
*
9+
*
1010
* Copyright (c) 2025 Project Millennium
11-
*
11+
*
1212
* Permission is hereby granted, free of charge, to any person obtaining a copy
1313
* of this software and associated documentation files (the "Software"), to deal
1414
* in the Software without restriction, including without limitation the rights
1515
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
* copies of the Software, and to permit persons to whom the Software is
1717
* furnished to do so, subject to the following conditions:
18-
*
18+
*
1919
* The above copyright notice and this permission notice shall be included in all
2020
* copies or substantial portions of the Software.
21-
*
21+
*
2222
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2323
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2424
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

0 commit comments

Comments
 (0)