diff --git a/CMakeLists.txt b/CMakeLists.txt index baeb663ddaa480176590e70954fa8905899727ed..8621445bdbfa690be179ba784487fd519db22efa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,4 @@ +# @author David Hermann cmake_minimum_required(VERSION 3.15) # Projektname und Sprache diff --git a/README.md b/README.md index e25f3b4f8e9dc1336d7b54c5685a45e2cba32fb2..74cbf6d73f0a2b055ad7f4da7da5942d85b9c1b3 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,56 @@ - Um `clang-tidy` für eine einzelne Datei (z.B. `main.cpp`) auszuführen: - `clang-tidy src/game/main.cpp -header-filter="src/game/main\.cpp" -p build/` + `clang-tidy src/game/main.cpp -header-filter="src/game/main\.cpp" -p build/` - Um `clang-tidy` für das ganze Projekt auszuführen und die Warnings in die Datei `clang-tidy-warnings.txt` zu schreiben: - `find src/game -name '*.cpp' -o -name '*.hpp' | xargs clang-tidy -header-filter="src/game/.*" -p build/ 1> clang-tidy-warnings.txt` + `find src/game -name '*.cpp' -o -name '*.hpp' | xargs clang-tidy -header-filter="src/game/.*" -p build/ 1> clang-tidy-warnings.txt` + ## Build-Anleitung ### Linux/MacOS 1. Repository klonen: - ```bash - git clone https://github.com/username/project.git - cd project - ``` + + ```bash + git clone https://github.com/username/project.git + cd project + ``` 2. Build-Verzeichnis erstellen: - ```bash - mkdir build && cd build - ``` + + ```bash + mkdir build && cd build + ``` 3. CMake konfigurieren und Build ausführen: - ```bash - cmake .. - cmake --build . - ``` + ```bash + cmake .. + cmake --build . + ``` ### Windows 1. Repository klonen: - ```powershell - git clone https://github.com/username/project.git - cd project - ``` + + ```powershell + git clone https://github.com/username/project.git + cd project + ``` 2. Build-Verzeichnis erstellen: - ```powershell - mkdir build - cd build - ``` + + ```powershell + mkdir build + cd build + ``` 3. CMake konfigurieren und Build ausführen: - ```powershell - cmake .. - cmake --build . --config Release - ``` + ```powershell + cmake .. + cmake --build . --config Release + ``` ### Visual Studio @@ -58,7 +63,6 @@ 4. Visual Studio erkennt automatisch das CMake-Projekt 5. Build über "Build All" ausführen - #### Falls Syntax errors 1. Erstelle .vscode/c_cpp_properties.json Datei @@ -66,21 +70,18 @@ ```json { - "configurations": [ - { - "name": "Fedora", - "includePath": [ - "/usr/include", - "/usr/include/SDL2" - ], - "defines": [], - "intelliSenseMode": "linux-gcc-x64", - "compilerPath": "/usr/bin/gcc", - "cStandard": "c17", - "cppStandard": "c++17" - } - ], - "version": 4 + "configurations": [ + { + "name": "Fedora", + "includePath": ["/usr/include", "/usr/include/SDL2"], + "defines": [], + "intelliSenseMode": "linux-gcc-x64", + "compilerPath": "/usr/bin/gcc", + "cStandard": "c17", + "cppStandard": "c++17" + } + ], + "version": 4 } ``` @@ -94,12 +95,13 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug # Debug-Build ``` ## Prerequisites for Leveleditor -- QT 6: ```sudo apt install qt6-base-dev``` +- QT 6: `sudo apt install qt6-base-dev` ## Authors Max Körschen: + - Units.cpp/hpp (Combat and movement) - Helpmenu.cpp/hpp - UnitInfoMenu.cpp/hpp @@ -108,8 +110,8 @@ Max Körschen: - level.cpp/hpp (eventhandling for units and buildings, movement, attack etc) - debugging in CombatEngine.cpp/hpp, Bullets.cpp/hpp - Lorenz Diel: + - Units.cpp/hpp - UnitInfoMenu.cpp/hpp - level.cpp/hpp @@ -118,6 +120,7 @@ Lorenz Diel: - CombatEngine.cpp/hpp David Maul: + - Engine.cpp/hpp - Scene.hpp - Spritesheet.cpp/hpp @@ -128,6 +131,7 @@ David Maul: - main.cpp Frederik Keens: + - main.cpp - Player.cpp/hpp - Level.cpp/hpp @@ -138,5 +142,20 @@ Frederik Keens: - Scene.hpp - Engine.cpp/hpp - - +David Hermann: + +- Projektmanagement (GitLab Issues, Milestones, etc.) +- Projektstruktur (Ordnerhierarchien) +- Refactoring der Architektur für bessere Modularität, Memory Management und Box2d Integration +- Spezifische Arbeit: + - CMakeLists.txt + - CombatEngine.cpp/hpp (refactoring, box2d integration) + - GameManager.cpp/hpp + - Unit.cpp/hpp (refactoring, box2d integration) + - Bullet.cpp/hpp + - Level.cpp/hpp (refactoring, box2d integration) + - PhysicsBody.cpp/hpp (box2d integration) + - PhysicsEngine.cpp/hpp (box2d integration) + - Menu.cpp/hpp (Main Menu UI) + - ContextMenu.cpp/hpp (Context Menu) + - Dimensions.hpp diff --git a/src/game/combat/CombatEngine.cpp b/src/game/combat/CombatEngine.cpp index 579b2609004d5878c24358c95b64059c7c156011..555b765594d4596279bee764a68543877b66fbd9 100644 --- a/src/game/combat/CombatEngine.cpp +++ b/src/game/combat/CombatEngine.cpp @@ -1,3 +1,10 @@ +/** + * CombatEngine.cpp + * + * @author Lorenz Diel + * @author David Hermann + */ + #include "CombatEngine.hpp" #include "../level/Level.hpp" @@ -5,11 +12,6 @@ #include <memory> #include <unordered_map> -/** - * @authors Lorenz Diel - */ - - namespace advanced_wars { diff --git a/src/game/combat/CombatEngine.hpp b/src/game/combat/CombatEngine.hpp index ba8520f9f216e8ce2afc0b5dde971a8dd7d072d8..3072099730f1ddc856fa1f66acefd9cad905421c 100644 --- a/src/game/combat/CombatEngine.hpp +++ b/src/game/combat/CombatEngine.hpp @@ -1,12 +1,15 @@ +/** + * CombatEngine.hpp + * + * @author Lorenz Diel + * @author David Hermann + */ + #pragma once #include "../core/Engine.hpp" #include "../entities/Unit.hpp" -/** - * @authors Lorenz Diel - */ - namespace advanced_wars { diff --git a/src/game/combat/Weapon.cpp b/src/game/combat/Weapon.cpp index 9b8e155a796d6807c1aca8ad5022c2abed4aef6d..153c0206d02211303249b1daa6fcce3643f5957f 100644 --- a/src/game/combat/Weapon.cpp +++ b/src/game/combat/Weapon.cpp @@ -1,9 +1,11 @@ -#include "Weapon.hpp" - /** - * @authors Lorenz Diel + * Weapon.cpp + * + * @author Lorenz Diel */ +#include "Weapon.hpp" + namespace advanced_wars { Weapon::Weapon() {} diff --git a/src/game/combat/Weapon.hpp b/src/game/combat/Weapon.hpp index 1031c041e02a02b3451af74c2cd167b0cfe1dbed..3c0f96d015c5df24e5cea647932a3e496ad93af6 100644 --- a/src/game/combat/Weapon.hpp +++ b/src/game/combat/Weapon.hpp @@ -1,12 +1,14 @@ +/** + * Weapon.hpp + * + * @author Lorenz Diel + */ + #pragma once #include <string> #include <unordered_map> -/** - * @authors Lorenz Diel - */ - namespace advanced_wars { diff --git a/src/game/core/Config.cpp b/src/game/core/Config.cpp index cc8381e1ed7809f8dd1ac54c718c42a112eca15c..f43a9185ef4657523806dfd79c1739a556f44a9e 100644 --- a/src/game/core/Config.cpp +++ b/src/game/core/Config.cpp @@ -1,3 +1,9 @@ +/** + * Config.cpp + * + * @author Lorenz Diel + */ + #include "Config.hpp" #include "../entities/Unit.hpp" @@ -9,10 +15,6 @@ #include <string> #include <unordered_map> -/** - * @authors Lorenz Diel - */ - namespace advanced_wars { diff --git a/src/game/core/Config.hpp b/src/game/core/Config.hpp index 5574b3d7473350000e3ee797d61c4f9336f1507c..fe8bbcce79ebd653b2dc62d291fb6ad8afd356e7 100644 --- a/src/game/core/Config.hpp +++ b/src/game/core/Config.hpp @@ -1,3 +1,9 @@ +/** + * Config.hpp + * + * @author Lorenz Diel + */ + #pragma once #include <boost/property_tree/ptree.hpp> @@ -6,10 +12,6 @@ #include <string> #include <unordered_map> -/** - * @authors Lorenz Diel - */ - namespace advanced_wars { /* ENUMS FOR GLOBAL USE*/ diff --git a/src/game/core/GameManager.cpp b/src/game/core/GameManager.cpp index dda9b65d76bfcb78b9adcd3887061649181a5f3c..ec647115647a8bc50d6a8ff35b9bf8a143825f18 100644 --- a/src/game/core/GameManager.cpp +++ b/src/game/core/GameManager.cpp @@ -1,3 +1,9 @@ +/** + * GameManager.cpp + * + * @author David Hermann + */ + #include "GameManager.hpp" #include <iostream> #include <memory> diff --git a/src/game/core/GameManager.hpp b/src/game/core/GameManager.hpp index c27334523740933e603dd85d83f9e97542d58300..4c071e1326829bb343ddc0cd95b47313ccf65459 100644 --- a/src/game/core/GameManager.hpp +++ b/src/game/core/GameManager.hpp @@ -1,3 +1,9 @@ +/** + * GameManager.hpp + * + * @author David Hermann + */ + #pragma once #include "../level/Level.hpp" diff --git a/src/game/effect/Effect.cpp b/src/game/effect/Effect.cpp index 1407e94788fdbb1b96687d4be0d6ce5aeb93a889..3c95704b0f6585f33b73bec2b166656bfb9ce077 100644 --- a/src/game/effect/Effect.cpp +++ b/src/game/effect/Effect.cpp @@ -1,5 +1,6 @@ /** * Effect.cpp + * * @author David Maul * @author Frederik Keens */ diff --git a/src/game/entities/Bullet.cpp b/src/game/entities/Bullet.cpp index 719715fc37192f09b3df82b8ddeef48be49b749a..15dd74e22f95a3646ae694b9b5e8f0b48ab2cf1d 100644 --- a/src/game/entities/Bullet.cpp +++ b/src/game/entities/Bullet.cpp @@ -1,3 +1,9 @@ +/** + * Bullet.cpp + * + * @author David Hermann + */ + #include "Bullet.hpp" #include "../core/Engine.hpp" #include "../physics/PhysicsBody.hpp" diff --git a/src/game/entities/Bullet.hpp b/src/game/entities/Bullet.hpp index a109214982b6dd7a6c45a22ceff0facd6fe9fb5f..15f273ad679afc3fd157a9caeb875c91b5c3e731 100644 --- a/src/game/entities/Bullet.hpp +++ b/src/game/entities/Bullet.hpp @@ -1,3 +1,9 @@ +/** + * Bullet.hpp + * + * @author David Hermann + */ + #pragma once #include "../core/Engine.hpp" diff --git a/src/game/entities/Unit.cpp b/src/game/entities/Unit.cpp index c8e338d913e1d6f7c09e6a4a711894c8d3af0e92..16b8a16c6af7e8ab44e9456ee7e4dbcad9a994d8 100644 --- a/src/game/entities/Unit.cpp +++ b/src/game/entities/Unit.cpp @@ -1,10 +1,11 @@ /** * Unit.cpp * - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will * @author Frederik Keens * @author Lorenz Diel + * @author David Hermann */ #include "Unit.hpp" @@ -65,14 +66,14 @@ Unit::Unit( Weapon(config.getUnitSecondaryWeapon(m_unitTypeId), secondaryDamage)); } -void Unit::update(float deltaTime) +void Unit::update() { if (!m_physicsBody) { return; } - m_physicsBody->update(deltaTime); + m_physicsBody->update(); b2Vec2 pos = m_physicsBody->getPosition(); calcState(static_cast<int>(pos.x), static_cast<int>(pos.y)); diff --git a/src/game/entities/Unit.hpp b/src/game/entities/Unit.hpp index a3f89bed7f1b7898b62ce97ab6c37640ece33bf5..6b6dee39e2f40ac05fc9c3f43f2e7f04ef67a838 100644 --- a/src/game/entities/Unit.hpp +++ b/src/game/entities/Unit.hpp @@ -1,10 +1,11 @@ /** * Unit.hpp * - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will * @author Frederik Keens * @author Lorenz Diel + * @author David Hermann */ #pragma once @@ -37,7 +38,7 @@ class Unit ~Unit(); /// Aktualisiert die Einheit (Bewegung, Physik, etc.). - void update(float deltaTime); + void update(); /// Bewegt die Einheit zu einer neuen Position. void moveTo(int posX, int posY); diff --git a/src/game/level/Level.cpp b/src/game/level/Level.cpp index ea6af4ba2ef74fcdc0915c95a64bb152c388894d..5bde2defb45e51a55c3f773d3ace3318b995c993 100644 --- a/src/game/level/Level.cpp +++ b/src/game/level/Level.cpp @@ -1,12 +1,12 @@ /** * Level.cpp * - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will * @author Frederik Keens * @author Lorenz Diel * @author David Maul - + * @author David Hermann */ #include "Level.hpp" @@ -381,7 +381,7 @@ void Level::render(Engine& engine) { Unit& unitRef = *unit; m_physicsEngine->step(deltaTime); - unitRef.update(deltaTime); + unitRef.update(); unitRef.render(engine, RENDERING_SCALE); } diff --git a/src/game/level/Level.hpp b/src/game/level/Level.hpp index ed9d6932e53513427156c8cddc46ebc5e8661220..3545fdc825a14a3f7b25c63c498e821c07efb4cc 100644 --- a/src/game/level/Level.hpp +++ b/src/game/level/Level.hpp @@ -1,11 +1,12 @@ /** * Level.hpp * - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will * @author Frederik Keens * @author Lorenz Diel * @author David Maul + * @author David Hermann */ #pragma once diff --git a/src/game/physics/PhysicsBody.cpp b/src/game/physics/PhysicsBody.cpp index 24bbaf9afe750aa0828970511aaa81695cebc135..369ba7d9fdb593e9c1bf6fb620bb5576d659ed60 100644 --- a/src/game/physics/PhysicsBody.cpp +++ b/src/game/physics/PhysicsBody.cpp @@ -1,3 +1,9 @@ +/** + * PhysicsBody.cpp + * + * @author David Hermann + */ + #include "PhysicsBody.hpp" #include "../../util/Dimensions.hpp" #include <box2d/box2d.h> @@ -29,7 +35,7 @@ PhysicsBody::PhysicsBody( m_fixture = m_body->CreateFixture(&fixtureDef); } -void PhysicsBody::update(float /*deltaTime*/) +void PhysicsBody::update() { if (m_body == nullptr) { diff --git a/src/game/physics/PhysicsBody.hpp b/src/game/physics/PhysicsBody.hpp index 5bb6d69bfa3c47ff22f66de87d23015b6fa6c746..70f1032e869f2a0d40c105065530e5135ff9ec81 100644 --- a/src/game/physics/PhysicsBody.hpp +++ b/src/game/physics/PhysicsBody.hpp @@ -1,3 +1,9 @@ +/** + * PhysicsBody.hpp + * + * @author David Hermann + */ + #pragma once #include "box2d/b2_body.h" @@ -17,7 +23,7 @@ class PhysicsBody PhysicsBody( b2World* world, int x, int y, float width, float height, float density, float friction, bool isSensor, BodyType type); - void update(float deltaTime); + void update(); void setTargetPosition(int targetTileX, int targetTileY); b2Vec2 getPosition() const; b2Vec2 getVelocity() const; diff --git a/src/game/physics/PhysicsEngine.cpp b/src/game/physics/PhysicsEngine.cpp index 54884b33a68273ebe676ae6f2e6531a9ec6261e5..8f5ded356251bfec977bea8979d039ec40b02457 100644 --- a/src/game/physics/PhysicsEngine.cpp +++ b/src/game/physics/PhysicsEngine.cpp @@ -1,3 +1,9 @@ +/** + * PhysicsEngine.cpp + * + * @author David Hermann + */ + #include "PhysicsEngine.hpp" #include "../entities/Bullet.hpp" #include "../entities/Unit.hpp" diff --git a/src/game/physics/PhysicsEngine.hpp b/src/game/physics/PhysicsEngine.hpp index a59683eb30202a209b0cf7cd7ed8916227a0ce0e..b1fdc30e83bd97562c5a1c7c3e7953b3facad463 100644 --- a/src/game/physics/PhysicsEngine.hpp +++ b/src/game/physics/PhysicsEngine.hpp @@ -1,3 +1,9 @@ +/** + * PhysicsEngine.hpp + * + * @author David Hermann + */ + #pragma once #include "PhysicsBody.hpp" diff --git a/src/game/ui/context/ContextMenu.cpp b/src/game/ui/context/ContextMenu.cpp index 1324409817654cb8f943b29593c309989c015e1b..e5da09c496080d0fd29acbeba55242dd65102313 100644 --- a/src/game/ui/context/ContextMenu.cpp +++ b/src/game/ui/context/ContextMenu.cpp @@ -1,6 +1,9 @@ /** - * @authors Max Körschen + * ContextMenu.cpp + * + * @author Max Körschen * @author Nicolas Will + * @author David Hermann */ #include "ContextMenu.hpp" diff --git a/src/game/ui/context/ContextMenu.hpp b/src/game/ui/context/ContextMenu.hpp index fdf50aa823edb35ea41e41ae4b65d45a0e16960b..af715a3c3a9700bcd73ed616b31928a87e5269eb 100644 --- a/src/game/ui/context/ContextMenu.hpp +++ b/src/game/ui/context/ContextMenu.hpp @@ -1,6 +1,9 @@ /** - * @authors Max Körschen + * ContextMenu.hpp + * + * @author Max Körschen * @author Nicolas Will + * @author David Hermann */ #pragma once diff --git a/src/game/ui/context/RecruitingMenu.cpp b/src/game/ui/context/RecruitingMenu.cpp index a0bd4210bcd8dacd40008a0557db92912ac1a080..a67a912d0b788efa7199c772ea36f30006c74667 100644 --- a/src/game/ui/context/RecruitingMenu.cpp +++ b/src/game/ui/context/RecruitingMenu.cpp @@ -1,5 +1,5 @@ /** - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will */ diff --git a/src/game/ui/context/RecruitingMenu.hpp b/src/game/ui/context/RecruitingMenu.hpp index 2c8dba2ab181abe38c736b09d40aba00228198dc..44b1455abb4f83eacff8a575a03d1dbd248c420c 100644 --- a/src/game/ui/context/RecruitingMenu.hpp +++ b/src/game/ui/context/RecruitingMenu.hpp @@ -1,5 +1,5 @@ /** - * @authors Max Körschen + * @author Max Körschen * @author Nicolas Will */ diff --git a/src/game/ui/menu/Menu.cpp b/src/game/ui/menu/Menu.cpp index 9d9cb4e11fe5a2b49be8482fc142a7281474bc99..afb071cee1acbd1ed212bbbd4e0b11f6130d27d5 100644 --- a/src/game/ui/menu/Menu.cpp +++ b/src/game/ui/menu/Menu.cpp @@ -1,3 +1,9 @@ +/** + * Menu.cpp + * + * @author David Hermann + */ + #include "Menu.hpp" #include "../../core/Config.hpp" #include "../../core/Spritesheet.hpp" diff --git a/src/game/ui/menu/Menu.hpp b/src/game/ui/menu/Menu.hpp index 5080a8af9ef0088fa3e353f5d499cd17b87d13c2..0eb8256ac190afd5fa48f462e3766633daa21f98 100644 --- a/src/game/ui/menu/Menu.hpp +++ b/src/game/ui/menu/Menu.hpp @@ -1,3 +1,9 @@ +/** + * Menu.hpp + * + * @author David Hermann + */ + #pragma once #include "../../core/Scene.hpp" diff --git a/src/util/Dimensions.hpp b/src/util/Dimensions.hpp index ffc679de95fd1d5722d5d2a1bcd78abf50db62fb..b9ca322c51886040a9ea4bdc502e0f07f4effa8f 100644 --- a/src/util/Dimensions.hpp +++ b/src/util/Dimensions.hpp @@ -1,3 +1,9 @@ +/** + * Dimensions.hpp + * + * @author David Hermann + */ + namespace advanced_wars {