From 0ad3dd7ab853770490ca74d65cbc847f54ebf48d Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 23 May 2024 02:05:08 +0300 Subject: [PATCH] build time decreased --- src/engine.cpp | 1 + src/engine.hpp | 2 +- src/files/WorldFiles.cpp | 1 + src/files/WorldFiles.hpp | 2 +- src/frontend/debug_panel.cpp | 1 + src/logic/LevelController.cpp | 2 ++ src/logic/LevelController.hpp | 2 +- src/logic/PlayerController.cpp | 1 + src/logic/PlayerController.hpp | 3 ++- src/objects/Player.hpp | 34 ++++++++++++++++------------------ src/voxel_engine.cpp | 3 +++ src/world/Level.cpp | 1 + src/world/Level.hpp | 2 +- src/world/World.cpp | 1 + src/world/World.hpp | 2 +- 15 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 0810d004..fa34c3c7 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -35,6 +35,7 @@ #include "window/input.hpp" #include "window/Window.hpp" #include "world/WorldGenerators.hpp" +#include "settings.hpp" #include #include diff --git a/src/engine.hpp b/src/engine.hpp index 61066143..878b1e54 100644 --- a/src/engine.hpp +++ b/src/engine.hpp @@ -2,7 +2,6 @@ #define ENGINE_HPP_ #include "delegates.hpp" -#include "settings.hpp" #include "typedefs.hpp" #include "assets/Assets.hpp" @@ -27,6 +26,7 @@ class ResPaths; class Batch2D; class EngineController; class SettingsHandler; +struct EngineSettings; namespace fs = std::filesystem; diff --git a/src/files/WorldFiles.cpp b/src/files/WorldFiles.cpp index ff9b2663..b5d68c85 100644 --- a/src/files/WorldFiles.cpp +++ b/src/files/WorldFiles.cpp @@ -13,6 +13,7 @@ #include "../objects/Player.hpp" #include "../physics/Hitbox.hpp" #include "../typedefs.hpp" +#include "../settings.hpp" #include "../util/data_io.hpp" #include "../voxels/Block.hpp" #include "../voxels/Chunk.hpp" diff --git a/src/files/WorldFiles.hpp b/src/files/WorldFiles.hpp index 7247b246..f2938416 100644 --- a/src/files/WorldFiles.hpp +++ b/src/files/WorldFiles.hpp @@ -5,7 +5,6 @@ #include "files.hpp" #include "../typedefs.hpp" -#include "../settings.hpp" #include "../content/ContentPack.hpp" #include "../voxels/Chunk.hpp" @@ -24,6 +23,7 @@ class Player; class Content; class ContentIndices; class World; +struct DebugSettings; namespace fs = std::filesystem; diff --git a/src/frontend/debug_panel.cpp b/src/frontend/debug_panel.cpp index a967ccad..014af2f0 100644 --- a/src/frontend/debug_panel.cpp +++ b/src/frontend/debug_panel.cpp @@ -1,6 +1,7 @@ #include "../audio/audio.hpp" #include "../delegates.hpp" #include "../engine.hpp" +#include "../settings.hpp" #include "../graphics/core/Mesh.hpp" #include "../graphics/ui/elements/CheckBox.hpp" #include "../graphics/ui/elements/TextBox.hpp" diff --git a/src/logic/LevelController.cpp b/src/logic/LevelController.cpp index 5e0cb198..479eff16 100644 --- a/src/logic/LevelController.cpp +++ b/src/logic/LevelController.cpp @@ -1,4 +1,6 @@ #include "LevelController.hpp" + +#include "../settings.hpp" #include "../files/WorldFiles.hpp" #include "../debug/Logger.hpp" #include "../world/Level.hpp" diff --git a/src/logic/LevelController.hpp b/src/logic/LevelController.hpp index 4c23ad77..3530df68 100644 --- a/src/logic/LevelController.hpp +++ b/src/logic/LevelController.hpp @@ -2,7 +2,6 @@ #define LOGIC_LEVEL_CONTROLLER_HPP_ #include -#include "../settings.hpp" #include "PlayerController.hpp" #include "BlocksController.hpp" @@ -10,6 +9,7 @@ class Level; class Player; +struct EngineSettings; /// @brief LevelController manages other controllers class LevelController { diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index 91bda4e8..fe5cfe75 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -22,6 +22,7 @@ #include "../items/ItemStack.hpp" #include "../items/Inventory.hpp" #include "../core_defs.hpp" +#include "../settings.hpp" const float CAM_SHAKE_OFFSET = 0.025f; const float CAM_SHAKE_OFFSET_Y = 0.031f; diff --git a/src/logic/PlayerController.hpp b/src/logic/PlayerController.hpp index bc2d1fb7..d48a3a51 100644 --- a/src/logic/PlayerController.hpp +++ b/src/logic/PlayerController.hpp @@ -1,7 +1,6 @@ #ifndef PLAYER_CONTROL_HPP_ #define PLAYER_CONTROL_HPP_ -#include "../settings.hpp" #include "../objects/Player.hpp" #include @@ -12,7 +11,9 @@ class Camera; class Level; class Block; +class Chunks; class BlocksController; +struct CameraSettings; class CameraControl { std::shared_ptr player; diff --git a/src/objects/Player.hpp b/src/objects/Player.hpp index 18b9cb13..54aa4b12 100644 --- a/src/objects/Player.hpp +++ b/src/objects/Player.hpp @@ -1,9 +1,9 @@ #ifndef SRC_OBJECTS_PLAYER_HPP_ #define SRC_OBJECTS_PLAYER_HPP_ +#include "../settings.hpp" #include "../data/dynamic.hpp" #include "../voxels/voxel.hpp" -#include "../settings.hpp" #include "../interfaces/Serializable.hpp" #include "../interfaces/Object.hpp" @@ -14,23 +14,22 @@ class Camera; class Hitbox; class Inventory; class ContentLUT; -class PhysicsSolver; -class Chunks; class Level; +struct EngineSettings; struct PlayerInput { - bool zoom; - bool cameraMode; - bool moveForward; - bool moveBack; - bool moveRight; - bool moveLeft; - bool sprint; - bool shift; - bool cheat; - bool jump; - bool noclip; - bool flight; + bool zoom : 1; + bool cameraMode : 1; + bool moveForward : 1; + bool moveBack : 1; + bool moveRight : 1; + bool moveLeft : 1; + bool sprint : 1; + bool shift : 1; + bool cheat : 1; + bool jump : 1; + bool noclip : 1; + bool flight : 1; }; class Player : public Object, public Serializable { @@ -46,8 +45,7 @@ public: bool noclip = false; bool debug = false; voxel selectedVoxel {0, 0}; - - glm::vec2 cam = {}; + glm::vec2 cam {}; Player(glm::vec3 position, float speed, std::shared_ptr inv); ~Player(); @@ -77,4 +75,4 @@ public: } }; -#endif /* SRC_OBJECTS_PLAYER_HPP_ */ +#endif // SRC_OBJECTS_PLAYER_HPP_ diff --git a/src/voxel_engine.cpp b/src/voxel_engine.cpp index eac242c5..33d18c0e 100644 --- a/src/voxel_engine.cpp +++ b/src/voxel_engine.cpp @@ -1,9 +1,11 @@ #include "engine.hpp" +#include "settings.hpp" #include "files/settings_io.hpp" #include "files/engine_paths.hpp" #include "util/platform.hpp" #include "util/command_line.hpp" #include "debug/Logger.hpp" +#include "objects/Player.hpp" #include @@ -11,6 +13,7 @@ static debug::Logger logger("main"); int main(int argc, char** argv) { debug::Logger::init("latest.log"); + std::cout << sizeof(PlayerInput) << std::endl; EnginePaths paths; if (!parse_cmdline(argc, argv, paths)) diff --git a/src/world/Level.cpp b/src/world/Level.cpp index 36f75e30..1df81c74 100644 --- a/src/world/Level.cpp +++ b/src/world/Level.cpp @@ -1,6 +1,7 @@ #include "Level.hpp" #include "World.hpp" #include "LevelEvents.hpp" +#include "../settings.hpp" #include "../content/Content.hpp" #include "../lighting/Lighting.hpp" #include "../voxels/Chunk.hpp" diff --git a/src/world/Level.hpp b/src/world/Level.hpp index 6b8f35c4..7b18f06f 100644 --- a/src/world/Level.hpp +++ b/src/world/Level.hpp @@ -1,7 +1,6 @@ #ifndef WORLD_LEVEL_HPP_ #define WORLD_LEVEL_HPP_ -#include "../settings.hpp" #include "../interfaces/Object.hpp" #include @@ -21,6 +20,7 @@ class LevelEvents; class Lighting; class PhysicsSolver; class ChunksStorage; +struct EngineSettings; /// @brief A level, contains chunks and objects class Level { diff --git a/src/world/World.cpp b/src/world/World.cpp index 6fb17b1e..a7bcab92 100644 --- a/src/world/World.cpp +++ b/src/world/World.cpp @@ -2,6 +2,7 @@ #include "Level.hpp" +#include "../settings.hpp" #include "../content/Content.hpp" #include "../content/ContentLUT.hpp" #include "../debug/Logger.hpp" diff --git a/src/world/World.hpp b/src/world/World.hpp index 57d94956..7d9e9748 100644 --- a/src/world/World.hpp +++ b/src/world/World.hpp @@ -2,7 +2,6 @@ #define WORLD_WORLD_HPP_ #include "../typedefs.hpp" -#include "../settings.hpp" #include "../util/timeutil.hpp" #include "../data/dynamic.hpp" #include "../interfaces/Serializable.hpp" @@ -17,6 +16,7 @@ class Content; class WorldFiles; class Level; class ContentLUT; +struct EngineSettings; namespace fs = std::filesystem;