From b4cecf10e801f989d4b9a004233b129e1d7e5aa6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 27 Jul 2024 14:28:20 +0200 Subject: [PATCH] Add .clang-format --- .clang-format | 67 + src/Application.cpp | 37 +- src/Application.h | 3 +- src/StorageUtils.cpp | 2 +- src/common/common.h | 9 +- src/entry.cpp | 14 +- src/fs/DirList.cpp | 16 +- src/fs/DirList.h | 7 +- src/fs/FSUtils.cpp | 15 +- src/game/GameList.cpp | 50 +- src/game/GameList.h | 10 +- src/gui/GameBgImage.h | 2 +- src/gui/GameIcon.cpp | 74 +- src/gui/GameIcon.h | 4 +- src/gui/GameIconModel.h | 7703 ++++++++++++++++++++-- src/gui/GuiButton.h | 2 +- src/gui/GuiIconGrid.cpp | 103 +- src/gui/GuiIconGrid.h | 18 +- src/gui/GuiImageAsync.h | 2 +- src/gui/GuiImageData.cpp | 2 +- src/gui/GuiTitleBrowser.h | 2 +- src/menu/GameSplashScreen.cpp | 34 +- src/menu/GameSplashScreen.h | 11 +- src/menu/KeyboardHelper.cpp | 10 +- src/menu/KeyboardHelper.h | 11 +- src/menu/MainDrcButtonsFrame.h | 15 +- src/menu/MainWindow.cpp | 68 +- src/menu/MainWindow.h | 10 +- src/resources/Resources.cpp | 34 +- src/resources/Resources.h | 4 +- src/sounds/BufferCircle.cpp | 2 +- src/sounds/Mp3Decoder.cpp | 2 +- src/sounds/OggDecoder.cpp | 2 +- src/sounds/SoundDecoder.cpp | 2 +- src/sounds/SoundDecoder.hpp | 2 +- src/sounds/SoundHandler.cpp | 4 +- src/sounds/SoundHandler.hpp | 2 +- src/utils/AsyncExecutor.cpp | 2 +- src/utils/AsyncExecutor.h | 12 +- src/utils/StringTools.cpp | 24 +- src/utils/StringTools.h | 9 +- src/utils/logger.h | 15 +- src/utils/utils.cpp | 64 +- src/utils/utils.h | 29 +- src/video/CVideo.cpp | 6 +- src/video/shaders/ColorShader.cpp | 2 +- src/video/shaders/FXAAShader.cpp | 2 +- src/video/shaders/Shader3D.cpp | 2 +- src/video/shaders/ShaderFractalColor.cpp | 2 +- src/video/shaders/Texture2DShader.cpp | 2 +- src/video/shaders/VertexShader.h | 2 +- 51 files changed, 7480 insertions(+), 1048 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..56cc685 --- /dev/null +++ b/.clang-format @@ -0,0 +1,67 @@ +# Generated from CLion C/C++ Code Style settings +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: Consecutive +AlignConsecutiveMacros: AcrossEmptyLinesAndComments +AlignOperands: Align +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Always +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: true +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +ColumnLimit: 0 +CompactNamespaces: false +ContinuationIndentWidth: 8 +IndentCaseLabels: true +IndentPPDirectives: None +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: All +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PointerAlignment: Right +ReflowComments: false +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never diff --git a/src/Application.cpp b/src/Application.cpp index 9f47639..8d84bea 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -14,29 +14,29 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . ****************************************************************************/ +#include "Application.h" +#include "common/common.h" +#include "resources/Resources.h" +#include "system/memory.h" +#include "utils/AsyncExecutor.h" +#include "utils/logger.h" #include #include #include -#include -#include -#include "Application.h" -#include "common/common.h" #include #include #include -#include "resources/Resources.h" +#include #include -#include "system/memory.h" -#include "utils/logger.h" -#include "utils/AsyncExecutor.h" +#include #include Application *Application::applicationInstance = nullptr; -bool Application::exitApplication = false; -bool Application::quitRequest = false; +bool Application::exitApplication = false; +bool Application::quitRequest = false; Application::Application() - : CThread(CThread::eAttributeAffCore1 | CThread::eAttributePinnedAff, 0, 0x800000), bgMusic(nullptr), video(nullptr), mainWindow(nullptr), fontSystem(nullptr), exitCode(0) { + : CThread(CThread::eAttributeAffCore1 | CThread::eAttributePinnedAff, 0, 0x800000), bgMusic(nullptr), video(nullptr), mainWindow(nullptr), fontSystem(nullptr), exitCode(0) { controller[0] = new VPadController(GuiTrigger::CHANNEL_1); controller[1] = new WPadController(GuiTrigger::CHANNEL_2); controller[2] = new WPadController(GuiTrigger::CHANNEL_3); @@ -62,7 +62,7 @@ Application::~Application() { DEBUG_FUNCTION_LINE("Destroy controller"); - for (auto &i: controller) { + for (auto &i : controller) { delete i; } @@ -88,15 +88,13 @@ int32_t Application::exec() { } void Application::quit(int32_t code) { - exitCode = code; + exitCode = code; exitApplication = true; - quitRequest = true; + quitRequest = true; } void Application::fadeOut() { - GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color) { - 0, 0, 0, 255 - }); + GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){0, 0, 0, 255}); for (int32_t i = 0; i < 255; i += 10) { if (i > 255) @@ -138,7 +136,7 @@ bool Application::procUI() { switch (ProcUIProcessMessages(true)) { case PROCUI_STATUS_EXITING: { DEBUG_FUNCTION_LINE("PROCUI_STATUS_EXITING"); - exitCode = EXIT_SUCCESS; + exitCode = EXIT_SUCCESS; exitApplication = true; break; } @@ -185,7 +183,6 @@ bool Application::procUI() { DEBUG_FUNCTION_LINE("Initialize main window"); mainWindow = new MainWindow(video->getTvWidth(), video->getTvHeight()); } - } executeProcess = true; } @@ -212,7 +209,7 @@ void Application::executeThread() { mainWindow->process(); //! Read out inputs - for (auto &i: controller) { + for (auto &i : controller) { if (!i->update(video->getTvWidth(), video->getTvHeight())) continue; diff --git a/src/Application.h b/src/Application.h index 2102f54..bae0cb2 100644 --- a/src/Application.h +++ b/src/Application.h @@ -18,8 +18,8 @@ #define _APPLICATION_H #include "menu/MainWindow.h" -#include