Prechádzať zdrojové kódy

refactor: submodules, code style

gugdun 1 mesiac pred
rodič
commit
1f539f4161

+ 0 - 272
.clang-format

@@ -1,272 +0,0 @@
----
-BasedOnStyle: Microsoft
-AccessModifierOffset: -4
-AlignAfterOpenBracket: BlockIndent
-AlignArrayOfStructures: Right
-AlignConsecutiveAssignments:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: true
-AlignConsecutiveBitFields:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignConsecutiveDeclarations:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignConsecutiveMacros:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignConsecutiveShortCaseStatements:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCaseArrows: false
-  AlignCaseColons: false
-AlignConsecutiveTableGenBreakingDAGArgColons:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignConsecutiveTableGenCondOperatorColons:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignConsecutiveTableGenDefinitionColons:
-  Enabled: false
-  AcrossEmptyLines: false
-  AcrossComments: false
-  AlignCompound: false
-  AlignFunctionPointers: false
-  PadOperators: false
-AlignEscapedNewlines: Left
-AlignOperands: Align
-AlignTrailingComments:
-  Kind: Always
-  OverEmptyLines: 0
-AllowAllArgumentsOnNextLine: true
-AllowAllParametersOfDeclarationOnNextLine: true
-AllowBreakBeforeNoexceptSpecifier: Never
-AllowShortBlocksOnASingleLine: Empty
-AllowShortCaseExpressionOnASingleLine: true
-AllowShortCaseLabelsOnASingleLine: false
-AllowShortCompoundRequirementOnASingleLine: true
-AllowShortEnumsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: AllIfsAndElse
-AllowShortLambdasOnASingleLine: All
-AllowShortLoopsOnASingleLine: true
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakBeforeMultilineStrings: false
-AttributeMacros:
-  - __capability
-BinPackArguments: true
-BinPackParameters: true
-BitFieldColonSpacing: Both
-BraceWrapping:
-  AfterCaseLabel: false
-  AfterClass: false
-  AfterControlStatement: Never
-  AfterEnum: false
-  AfterFunction: false
-  AfterNamespace: false
-  AfterObjCDeclaration: true
-  AfterStruct: false
-  AfterUnion: false
-  AfterExternBlock: false
-  BeforeCatch: false
-  BeforeElse: false
-  BeforeLambdaBody: false
-  BeforeWhile: false
-  IndentBraces: false
-  SplitEmptyFunction: true
-  SplitEmptyRecord: true
-  SplitEmptyNamespace: true
-BreakAdjacentStringLiterals: true
-BreakAfterAttributes: Leave
-BreakAfterJavaFieldAnnotations: false
-BreakAfterReturnType: None
-BreakArrays: true
-BreakBeforeBinaryOperators: None
-BreakBeforeBraces: Custom
-BreakBeforeConceptDeclarations: Always
-BreakBeforeInlineASMColon: OnlyMultiline
-BreakBeforeTernaryOperators: true
-BreakConstructorInitializers: BeforeColon
-BreakFunctionDefinitionParameters: false
-BreakInheritanceList: BeforeColon
-BreakStringLiterals: true
-BreakTemplateDeclarations: MultiLine
-ColumnLimit: 120
-CommentPragmas: "^ IWYU pragma:"
-CompactNamespaces: false
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: false
-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: false
-InsertNewlineAtEOF: false
-InsertTrailingCommas: None
-IntegerLiteralSeparator:
-  Binary: 0
-  BinaryMinDigits: 0
-  Decimal: 0
-  DecimalMinDigits: 0
-  Hex: 0
-  HexMinDigits: 0
-JavaScriptQuotes: Leave
-JavaScriptWrapImports: true
-KeepEmptyLines:
-  AtEndOfFile: false
-  AtStartOfBlock: true
-  AtStartOfFile: true
-LambdaBodyIndentation: Signature
-LineEnding: LF
-MacroBlockBegin: ""
-MacroBlockEnd: ""
-MainIncludeChar: Quote
-MaxEmptyLinesToKeep: 1
-NamespaceIndentation: None
-ObjCBinPackProtocolList: Auto
-ObjCBlockIndentWidth: 2
-ObjCBreakBeforeNestedBlockParam: true
-ObjCSpaceAfterProperty: false
-ObjCSpaceBeforeProtocolList: true
-PPIndentWidth: -1
-PackConstructorInitializers: Never
-PenaltyBreakAssignment: 2
-PenaltyBreakBeforeFirstCallParameter: 19
-PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
-PenaltyBreakOpenParenthesis: 0
-PenaltyBreakScopeResolution: 500
-PenaltyBreakString: 1000
-PenaltyBreakTemplateDeclaration: 10
-PenaltyExcessCharacter: 1000000
-PenaltyIndentedWhitespace: 0
-PenaltyReturnTypeOnItsOwnLine: 1000
-PointerAlignment: Right
-QualifierAlignment: Leave
-ReferenceAlignment: Pointer
-ReflowComments: true
-RemoveBracesLLVM: false
-RemoveParentheses: Leave
-RemoveSemicolon: false
-RequiresClausePosition: OwnLine
-RequiresExpressionIndentation: OuterScope
-SeparateDefinitionBlocks: Leave
-ShortNamespaceLines: 1
-SkipMacroDefinitionBody: false
-SortIncludes: CaseSensitive
-SortJavaStaticImport: Before
-SortUsingDeclarations: LexicographicNumeric
-SpaceAfterCStyleCast: false
-SpaceAfterLogicalNot: false
-SpaceAfterTemplateKeyword: true
-SpaceAroundPointerQualifiers: Default
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeCaseColon: false
-SpaceBeforeCpp11BracedList: true
-SpaceBeforeCtorInitializerColon: true
-SpaceBeforeInheritanceColon: true
-SpaceBeforeJsonColon: false
-SpaceBeforeParens: ControlStatements
-SpaceBeforeParensOptions:
-  AfterControlStatements: true
-  AfterForeachMacros: true
-  AfterFunctionDeclarationName: false
-  AfterFunctionDefinitionName: false
-  AfterIfMacros: true
-  AfterOverloadedOperator: false
-  AfterPlacementOperator: true
-  AfterRequiresInClause: false
-  AfterRequiresInExpression: false
-  BeforeNonEmptyParentheses: false
-SpaceBeforeRangeBasedForLoopColon: true
-SpaceBeforeSquareBrackets: false
-SpaceInEmptyBlock: false
-SpacesBeforeTrailingComments: 1
-SpacesInAngles: Never
-SpacesInContainerLiterals: true
-SpacesInLineCommentPrefix:
-  Minimum: 1
-  Maximum: -1
-SpacesInParens: Never
-SpacesInParensOptions:
-  ExceptDoubleParentheses: false
-  InConditionalStatements: false
-  InCStyleCasts: false
-  InEmptyParentheses: false
-  Other: false
-SpacesInSquareBrackets: false
-Standard: Latest
-StatementAttributeLikeMacros:
-  - Q_EMIT
-StatementMacros:
-  - Q_UNUSED
-  - QT_REQUIRE_VERSION
-TabWidth: 4
-TableGenBreakInsideDAGArg: DontBreak
-UseTab: Never
-VerilogBreakBetweenInstancePorts: true
-WhitespaceSensitiveMacros:
-  - BOOST_PP_STRINGIZE
-  - CF_SWIFT_NAME
-  - NS_SWIFT_NAME
-  - PP_STRINGIZE
-  - STRINGIZE

+ 0 - 9
.clangd

@@ -1,9 +0,0 @@
-CompileFlags:
-  Remove: [
-    -fmodules-ts,
-    -fmodule-mapper=CMakeFiles/dungeon.dir/src/Dungeon.cpp.o.modmap,
-    -fmodule-mapper=CMakeFiles/dungeon.dir/src/components/Position.cpp.o.modmap,
-    -fmodule-mapper=CMakeFiles/dungeon.dir/src/components/Sprite.cpp.o.modmap,
-    -fmodule-mapper=CMakeFiles/dungeon.dir/src/systems/RenderingSystem.cpp.o.modmap,
-    -fdeps-format=p1689r5
-  ]

+ 3 - 0
.gitignore

@@ -1,4 +1,7 @@
 .vs
+.vscode
+.idea
+.ccls-cache
 .cache
 build
 out

+ 9 - 9
.gitmodules

@@ -1,15 +1,15 @@
 [submodule "lib/SDL"]
 	path = lib/SDL
-	url = https://github.com/libsdl-org/SDL
-[submodule "lib/tinyxml2"]
-	path = lib/tinyxml2
-	url = https://github.com/leethomason/tinyxml2
+	url = https://git.svin.pro/gugdun/SDL.git
 [submodule "lib/entt"]
 	path = lib/entt
-	url = https://github.com/skypjack/entt
-[submodule "lib/pocketpy"]
-	path = lib/pocketpy
-	url = https://github.com/pocketpy/pocketpy
+	url = https://git.svin.pro/gugdun/entt.git
 [submodule "lib/physfs"]
 	path = lib/physfs
-	url = https://github.com/icculus/physfs
+	url = https://git.svin.pro/gugdun/physfs.git
+[submodule "lib/tinyxml2"]
+	path = lib/tinyxml2
+	url = https://git.svin.pro/gugdun/tinyxml2.git
+[submodule "lib/pocketpy"]
+	path = lib/pocketpy
+	url = https://git.svin.pro/gugdun/pocketpy.git

+ 1 - 1
lib/SDL

@@ -1 +1 @@
-Subproject commit 34b620c3f86cb2b5adf11440cdf79a3cec216269
+Subproject commit cd72f6b02eea3023fa208560774a78193cf9de35

+ 0 - 3
src/AppState.hpp

@@ -4,8 +4,6 @@
 #include <SDL3/SDL_video.h>
 #include <entt/entt.hpp>
 
-#include "systems/RenderingSystem.hpp"
-
 namespace Dungeon {
 
 struct AppState {
@@ -13,7 +11,6 @@ struct AppState {
     SDL_Renderer *renderer;
     entt::registry registry;
     entt::dispatcher dispatcher;
-    RenderingSystem renderingSystem;
 };
 
 } // namespace Dungeon

+ 35 - 26
src/Dungeon.cpp

@@ -10,15 +10,21 @@
 #include "AppState.hpp"
 #include "components/Position.hpp"
 #include "components/Sprite.hpp"
+#include "systems/RenderingSystem.hpp"
+
+using namespace Dungeon;
 
 SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
-    Dungeon::AppState *state = new Dungeon::AppState;
+    auto *state = new AppState;
 
     PHYSFS_init(argv[0]);
     PHYSFS_mount("assets", "/assets", 1);
 
     bool success = SDL_CreateWindowAndRenderer(
-        "Penis Dungeon", 1280, 720, SDL_WINDOW_HIGH_PIXEL_DENSITY, &state->window, &state->renderer
+        "Penis Dungeon",
+        1280, 720,
+        SDL_WINDOW_HIGH_PIXEL_DENSITY,
+        &state->window, &state->renderer
     );
 
     if (!success) {
@@ -28,20 +34,21 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
 
     try {
         const auto boar = state->registry.create();
-        const char *boar_path = "/assets/boar.xml";
+        auto boar_path = "/assets/boar.xml";
 
-        if (!PHYSFS_exists(boar_path)) throw std::string("boar.xml not found!");
+        if (!PHYSFS_exists(boar_path)) {
+            throw std::runtime_error("boar.xml not found!");
+        }
         PHYSFS_file *file = PHYSFS_openRead(boar_path);
         PHYSFS_sint64 length = PHYSFS_fileLength(file);
-        char *buffer = new char[length];
+        auto buffer = new char[length];
         PHYSFS_readBytes(file, buffer, length);
         PHYSFS_close(file);
 
         tinyxml2::XMLDocument doc;
-        tinyxml2::XMLError error = doc.Parse(buffer);
-        if (error != tinyxml2::XML_SUCCESS) {
+        if (auto error = doc.Parse(buffer); error != tinyxml2::XML_SUCCESS) {
             delete[] buffer;
-            throw std::string("Failed to parse XML");
+            throw std::runtime_error("Failed to parse XML");
         }
 
         tinyxml2::XMLElement *root = doc.RootElement();
@@ -49,37 +56,39 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
 
         for (int i = 0; i < root->ChildElementCount(); i++) {
             if (std::string(component->Name()) == "Position") {
-                Dungeon::Position pos = Dungeon::Position::FromXML(component);
-                state->registry.emplace<Dungeon::Position>(boar, pos);
+                Position pos = Position::FromXML(component);
+                state->registry.emplace<Position>(boar, pos);
             } else if (std::string(component->Name()) == "Sprite") {
-                Dungeon::Sprite sprite = Dungeon::Sprite::FromXML(state->renderer, component);
-                state->registry.emplace<Dungeon::Sprite>(boar, sprite);
+                Sprite sprite = Sprite::FromXML(state->renderer, component);
+                state->registry.emplace<Sprite>(boar, sprite);
+            }
+            if (auto *next = component->NextSibling()) {
+                component = next->ToElement();
             }
-            tinyxml2::XMLNode *next = component->NextSibling();
-            if (next) component = next->ToElement();
         };
 
         delete[] buffer;
-    } catch (std::string ex) {
-        SDL_Log("Failed to construct 'boar' entity: %s", ex.c_str());
+    } catch (const std::exception &ex) {
+        SDL_Log("Failed to construct 'boar' entity: %s", ex.what());
     }
 
     *appstate = state;
     return SDL_APP_CONTINUE;
 }
 
+// ReSharper disable once CppParameterMayBeConstPtrOrRef
 SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
-    Dungeon::AppState *state = static_cast<Dungeon::AppState *>(appstate);
+    auto *state = static_cast<AppState *>(appstate);
 
     if (event->type == SDL_EVENT_QUIT) {
         return SDL_APP_SUCCESS;
     } else if (event->type == SDL_EVENT_KEY_DOWN) {
         switch (event->key.scancode) {
-        case SDL_SCANCODE_ESCAPE:
-            return SDL_APP_SUCCESS;
-            break;
-        default:
-            break;
+            case SDL_SCANCODE_ESCAPE:
+                return SDL_APP_SUCCESS;
+                break;
+            default:
+                break;
         }
     }
 
@@ -87,24 +96,24 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
 }
 
 SDL_AppResult SDL_AppIterate(void *appstate) {
-    Dungeon::AppState *state = static_cast<Dungeon::AppState *>(appstate);
+    auto *state = static_cast<AppState *>(appstate);
 
     int w = 0, h = 0;
     SDL_GetRenderOutputSize(state->renderer, &w, &h);
-    const float scale = h / 180.0f;
+    const float scale = static_cast<float>(h) / 180.0f;
     SDL_SetRenderScale(state->renderer, scale, scale);
 
     SDL_SetRenderDrawColor(state->renderer, 50, 200, 255, 255);
     SDL_RenderClear(state->renderer);
 
-    state->renderingSystem.Render(state->renderer, state->registry);
+    RenderingSystem::Render(state->renderer, state->registry);
 
     SDL_RenderPresent(state->renderer);
     return SDL_APP_CONTINUE;
 }
 
 void SDL_AppQuit(void *appstate, SDL_AppResult result) {
-    Dungeon::AppState *state = static_cast<Dungeon::AppState *>(appstate);
+    const auto *state = static_cast<AppState *>(appstate);
     delete state;
     PHYSFS_deinit();
 }

+ 6 - 8
src/components/Position.cpp

@@ -1,12 +1,10 @@
 #include "Position.hpp"
 
 namespace Dungeon {
-
-Position Position::FromXML(tinyxml2::XMLElement *element) {
-    float x = 0, y = 0;
-    element->QueryFloatAttribute("x", &x);
-    element->QueryFloatAttribute("y", &y);
-    return Position { x, y };
+    Position Position::FromXML(const tinyxml2::XMLElement *element) {
+        float x = 0, y = 0;
+        element->QueryFloatAttribute("x", &x);
+        element->QueryFloatAttribute("y", &y);
+        return Position{x, y};
+    }
 }
-
-} // namespace Dungeon

+ 6 - 7
src/components/Position.hpp

@@ -1,12 +1,11 @@
 #pragma once
 
 #include "tinyxml2.h"
-namespace Dungeon {
-
-struct Position {
-    float x, y;
 
-    static Position FromXML(tinyxml2::XMLElement *element);
-};
+namespace Dungeon {
+    struct Position {
+        float x, y;
 
-} // namespace Dungeon
+        static Position FromXML(const tinyxml2::XMLElement *element);
+    };
+}

+ 46 - 43
src/components/Sprite.cpp

@@ -8,50 +8,53 @@
 #include "../stb_image.h"
 
 namespace Dungeon {
-
-Sprite Sprite::FromFile(SDL_Renderer *renderer, std::string path) {
-    Sprite sprite;
-    SDL_Surface *surface = nullptr;
-
-    if (!PHYSFS_exists(path.c_str())) throw std::format("File not found: {}", path);
-    PHYSFS_file *file = PHYSFS_openRead(path.c_str());
-    PHYSFS_sint64 length = PHYSFS_fileLength(file);
-    unsigned char *buffer = new unsigned char[length];
-    PHYSFS_readBytes(file, buffer, length);
-    PHYSFS_close(file);
-
-    int width, height, channels;
-    unsigned char *image = stbi_load_from_memory(buffer, length, &width, &height, &channels, 4);
-    if (!image) {
-        delete[] buffer;
-        throw std::format("Failed to parse image: {}", path);
+    Sprite Sprite::FromFile(SDL_Renderer *renderer, std::string path) {
+        Sprite sprite{};
+        SDL_Surface *surface = nullptr;
+
+        if (!PHYSFS_exists(path.c_str())) {
+            throw std::runtime_error(std::format("File not found: {}", path));
+        }
+        PHYSFS_file *file = PHYSFS_openRead(path.c_str());
+        const PHYSFS_sint64 length = PHYSFS_fileLength(file);
+        auto *buffer = new unsigned char[length];
+        PHYSFS_readBytes(file, buffer, length);
+        PHYSFS_close(file);
+
+        int width, height, channels;
+        unsigned char *image = stbi_load_from_memory(
+            buffer, static_cast<int>(length),
+            &width, &height, &channels, 4
+        );
+        if (!image) {
+            delete[] buffer;
+            throw std::runtime_error(std::format("Failed to parse image: {}", path));
+        }
+
+        surface = SDL_CreateSurfaceFrom(width, height, SDL_PIXELFORMAT_ABGR8888, image, width * channels);
+        if (surface == nullptr) {
+            throw std::runtime_error(std::format("Unable to load spritesheet file: {}", path));
+        }
+
+        sprite.texture = SDL_CreateTextureFromSurface(renderer, surface);
+        sprite.rect.w = static_cast<float>(sprite.texture->w);
+        sprite.rect.h = static_cast<float>(sprite.texture->h);
+        sprite.rect.x = sprite.rect.y = 0;
+
+        SDL_SetTextureScaleMode(sprite.texture, SDL_SCALEMODE_NEAREST);
+        SDL_DestroySurface(surface);
+        return sprite;
     }
 
-    surface = SDL_CreateSurfaceFrom(width, height, SDL_PIXELFORMAT_ABGR8888, image, width * channels);
-    if (surface == nullptr) {
-        throw std::format("Unable to load spritesheet file: {}", path);
+    Sprite Sprite::FromXML(SDL_Renderer *renderer, tinyxml2::XMLElement *element) {
+        const char *path;
+        element->QueryStringAttribute("texture", &path);
+        Sprite sprite = FromFile(renderer, path);
+        const auto *rect = element->FirstChildElement();
+        rect->QueryFloatAttribute("x", &sprite.rect.x);
+        rect->QueryFloatAttribute("y", &sprite.rect.y);
+        rect->QueryFloatAttribute("w", &sprite.rect.w);
+        rect->QueryFloatAttribute("h", &sprite.rect.h);
+        return sprite;
     }
-
-    sprite.texture = SDL_CreateTextureFromSurface(renderer, surface);
-    sprite.rect.x = sprite.rect.y = 0;
-    sprite.rect.w = sprite.texture->w;
-    sprite.rect.h = sprite.texture->h;
-
-    SDL_SetTextureScaleMode(sprite.texture, SDL_SCALEMODE_NEAREST);
-    SDL_DestroySurface(surface);
-    return sprite;
 }
-
-Sprite Sprite::FromXML(SDL_Renderer *renderer, tinyxml2::XMLElement *element) {
-    const char *path;
-    element->QueryStringAttribute("texture", &path);
-    Dungeon::Sprite sprite = Dungeon::Sprite::FromFile(renderer, path);
-    tinyxml2::XMLElement *rect = element->FirstChildElement();
-    rect->QueryFloatAttribute("x", &sprite.rect.x);
-    rect->QueryFloatAttribute("y", &sprite.rect.y);
-    rect->QueryFloatAttribute("w", &sprite.rect.w);
-    rect->QueryFloatAttribute("h", &sprite.rect.h);
-    return sprite;
-}
-
-} // namespace Dungeon

+ 7 - 8
src/components/Sprite.hpp

@@ -5,13 +5,12 @@
 #include <string>
 
 namespace Dungeon {
+    struct Sprite {
+        SDL_Texture *texture;
+        SDL_FRect rect;
 
-struct Sprite {
-    SDL_Texture *texture;
-    SDL_FRect rect;
+        static Sprite FromFile(SDL_Renderer *renderer, std::string path);
 
-    static Sprite FromFile(SDL_Renderer *renderer, std::string path);
-    static Sprite FromXML(SDL_Renderer *renderer, tinyxml2::XMLElement *element);
-};
-
-} // namespace Dungeon
+        static Sprite FromXML(SDL_Renderer *renderer, tinyxml2::XMLElement *element);
+    };
+}

+ 4 - 4
src/systems/RenderingSystem.cpp

@@ -3,10 +3,10 @@
 #include "../components/Sprite.hpp"
 
 void Dungeon::RenderingSystem::Render(SDL_Renderer *renderer, entt::registry &registry) {
-    auto view = registry.view<Position, Sprite>();
-    
-    view.each([&](const Position &p, Sprite &s) {
-        SDL_FRect dstRect = { p.x, p.y, s.rect.w, s.rect.h };
+    const auto view = registry.view<Position, Sprite>();
+
+    view.each([&](const Position &p, const Sprite &s) {
+        const SDL_FRect dstRect = {p.x, p.y, s.rect.w, s.rect.h};
         SDL_RenderTexture(renderer, s.texture, &s.rect, &dstRect);
     });
 }

+ 5 - 7
src/systems/RenderingSystem.hpp

@@ -4,10 +4,8 @@
 #include <entt/entt.hpp>
 
 namespace Dungeon {
-
-class RenderingSystem {
-public:
-    void Render(SDL_Renderer *renderer, entt::registry &registry);
-};
-
-} // namespace Dungeon
+    class RenderingSystem {
+    public:
+        static void Render(SDL_Renderer *renderer, entt::registry &registry);
+    };
+}