diff options
41 files changed, 182 insertions, 129 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp index 303f18a..0507bc1 100644 --- a/src/AssetManager.cpp +++ b/src/AssetManager.cpp @@ -1,7 +1,13 @@ -#include <fstream> #include "AssetManager.hpp" + +#include <fstream> #include <experimental/filesystem> +#include <nlohmann/json.hpp> +#include <easylogging++.h> + +#include "Texture.hpp" + namespace fs = std::experimental::filesystem::v1; //const fs::path pathToAssets = "./assets/"; diff --git a/src/AssetManager.hpp b/src/AssetManager.hpp index 7cb7f8f..1169b7d 100644 --- a/src/AssetManager.hpp +++ b/src/AssetManager.hpp @@ -1,15 +1,16 @@ #pragma once +#include <string> +#include <vector> #include <map> -#include <optional> #include <GL/glew.h> #include <glm/vec4.hpp> -#include <nlohmann/json.hpp> -#include "Block.hpp" -#include "Texture.hpp" #include "Vector.hpp" +#include "Block.hpp" + +class Texture; struct TextureCoordinates { TextureCoordinates(float x = -1, float y = -1, float w = -1, float h = -1) : x(x), y(y), w(w), h(h) {} diff --git a/src/Event.cpp b/src/Event.cpp index 1a0816f..1f3a9e8 100644 --- a/src/Event.cpp +++ b/src/Event.cpp @@ -1,6 +1,9 @@ #include "Event.hpp" + #include <easylogging++.h> +#include "Utility.hpp" + std::queue<Event> EventAgregator::eventsToHandle; std::mutex EventAgregator::queueMutex; bool EventAgregator::isStarted = false; diff --git a/src/Event.hpp b/src/Event.hpp index 021af0d..4962ee9 100644 --- a/src/Event.hpp +++ b/src/Event.hpp @@ -4,15 +4,15 @@ #include <map> #include <thread> #include <mutex> -#include <condition_variable> -#include <chrono> #include <variant> #include <functional> #include <SDL.h> #include "Vector.hpp" -#include "Packet.hpp" +#include "Chat.hpp" + +class Packet; enum class EventType { Echo, diff --git a/src/GameState.cpp b/src/GameState.cpp index 945824f..cea92d6 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -1,7 +1,11 @@ #include "GameState.hpp" + +#include <glm/gtc/matrix_transform.hpp> +#include <easylogging++.h> + #include "Event.hpp" -#include <iomanip> -#include "GlobalState.hpp" +#include "Packet.hpp" +#include "NetworkClient.hpp" void GameState::Update(float deltaTime) { if (g_IsGameStarted) { diff --git a/src/GameState.hpp b/src/GameState.hpp index 0551f1c..bee89bf 100644 --- a/src/GameState.hpp +++ b/src/GameState.hpp @@ -1,15 +1,18 @@ #pragma once -#include <nlohmann/json.hpp> -#include <glm/glm.hpp> -#include <glm/gtc/matrix_transform.hpp> +#include <mutex> +#include <queue> +#include <memory> + +#include <glm/mat4x4.hpp> #include "World.hpp" -#include "NetworkClient.hpp" -#include "Vector.hpp" -#include "Event.hpp" #include "Window.hpp" +class Packet; +class NetworkClient; +class Entity; + class GameState { std::mutex packetsMutex; std::queue<std::shared_ptr<Packet>> packets; diff --git a/src/GlobalState.cpp b/src/GlobalState.cpp index 23c7e51..c7a36ad 100644 --- a/src/GlobalState.cpp +++ b/src/GlobalState.cpp @@ -4,6 +4,7 @@ #include "GameState.hpp" #include "Render.hpp" #include "DebugInfo.hpp" +#include "Event.hpp" //Global game variables diff --git a/src/GlobalState.hpp b/src/GlobalState.hpp index c0f1769..b3b4635 100644 --- a/src/GlobalState.hpp +++ b/src/GlobalState.hpp @@ -1,8 +1,5 @@ #pragma once -#include <memory> -#include <thread> - class NetworkClient; class GameState; class Render; diff --git a/src/Network.cpp b/src/Network.cpp index 2c14327..c8be740 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -1,6 +1,9 @@ #include "Network.hpp" #include <zlib.h> +#include <easylogging++.h> + +#include "Socket.hpp" Network::Network(std::string address, unsigned short port) { try { diff --git a/src/Network.hpp b/src/Network.hpp index f28f808..5d7fc38 100644 --- a/src/Network.hpp +++ b/src/Network.hpp @@ -1,10 +1,9 @@ #pragma once #include <memory> -#include "Socket.hpp" #include "Packet.hpp" -enum ConnectionState { +enum ConnectionState : unsigned char { Handshaking, Login, Play, diff --git a/src/NetworkClient.cpp b/src/NetworkClient.cpp index 36c6912..38cb947 100644 --- a/src/NetworkClient.cpp +++ b/src/NetworkClient.cpp @@ -1,7 +1,11 @@ #include "NetworkClient.hpp" -NetworkClient::NetworkClient(std::string address, unsigned short port, std::string username) - : network(address, port) { +#include <easylogging++.h> + +#include "Network.hpp" + +NetworkClient::NetworkClient(std::string address, unsigned short port, std::string username) { + network = std::make_unique<Network>(address, port); state = Handshaking; PacketHandshake handshake; @@ -9,18 +13,18 @@ NetworkClient::NetworkClient(std::string address, unsigned short port, std::stri handshake.serverAddress = address; handshake.serverPort = port; handshake.nextState = 2; - network.SendPacket(handshake); + network->SendPacket(handshake); state = Login; PacketLoginStart loginStart; loginStart.Username = username; - network.SendPacket(loginStart); + network->SendPacket(loginStart); - auto packet = network.ReceivePacket(Login); + auto packet = network->ReceivePacket(Login); while (!packet) - packet = network.ReceivePacket(Login); + packet = network->ReceivePacket(Login); if (packet->GetPacketId() == PacketNameLoginCB::SetCompression) { auto compPacket = std::static_pointer_cast<PacketSetCompression>(packet); @@ -28,7 +32,7 @@ NetworkClient::NetworkClient(std::string address, unsigned short port, std::stri compressionThreshold = compPacket->Threshold; packet.reset(); while (!packet) - packet = network.ReceivePacket(Login, compressionThreshold >= 0); + packet = network->ReceivePacket(Login, compressionThreshold >= 0); } auto response = std::static_pointer_cast<PacketLoginSuccess>(packet); @@ -60,11 +64,11 @@ void NetworkClient::SendPacket(std::shared_ptr<Packet> packet) { void NetworkClient::UpdatePacket() { while (!toSend.empty()) { if (toSend.front() != nullptr) - network.SendPacket(*toSend.front(), compressionThreshold); + network->SendPacket(*toSend.front(), compressionThreshold); toSend.pop(); } - auto packet = network.ReceivePacket(state, compressionThreshold >= 0); + auto packet = network->ReceivePacket(state, compressionThreshold >= 0); if (packet.get() != nullptr) { if (packet->GetPacketId() != PacketNamePlayCB::KeepAliveCB) { toReceive.push(packet); @@ -73,7 +77,7 @@ void NetworkClient::UpdatePacket() { timeOfLastKeepAlivePacket = std::chrono::steady_clock::now(); auto packetKeepAlive = std::static_pointer_cast<PacketKeepAliveCB>(packet); auto packetKeepAliveSB = std::make_shared<PacketKeepAliveSB>(packetKeepAlive->KeepAliveId); - network.SendPacket(*packetKeepAliveSB, compressionThreshold); + network->SendPacket(*packetKeepAliveSB, compressionThreshold); } } using namespace std::chrono_literals; diff --git a/src/NetworkClient.hpp b/src/NetworkClient.hpp index a26c262..2bcbd9f 100644 --- a/src/NetworkClient.hpp +++ b/src/NetworkClient.hpp @@ -1,14 +1,16 @@ #pragma once -#include <thread> +#include <memory> #include <queue> -#include <mutex> +#include <string> +#include <chrono> -#include "Network.hpp" -#include "Event.hpp" +class Network; +struct Packet; +enum ConnectionState : unsigned char; class NetworkClient { - Network network; + std::unique_ptr<Network> network; std::queue <std::shared_ptr<Packet>> toSend; std::queue <std::shared_ptr<Packet>> toReceive; ConnectionState state; diff --git a/src/Render.cpp b/src/Render.cpp index befc982..1e7f45c 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -1,14 +1,17 @@ #include "Render.hpp" -#include "Utility.hpp" +#include <imgui.h> +#include <easylogging++.h> + +#include "imgui_impl_sdl_gl3.h" #include "Shader.hpp" #include "AssetManager.hpp" #include "Event.hpp" #include "DebugInfo.hpp" #include "GlobalState.hpp" - -#include <imgui.h> -#include "imgui_impl_sdl_gl3.h" +#include "World.hpp" +#include "GameState.hpp" +#include "RendererWorld.hpp" Render::Render(unsigned int windowWidth, unsigned int windowHeight, std::string windowTitle) : timer(std::chrono::milliseconds(16)) { InitSfml(windowWidth, windowHeight, windowTitle); diff --git a/src/Render.hpp b/src/Render.hpp index 8c4b4e8..3998f26 100644 --- a/src/Render.hpp +++ b/src/Render.hpp @@ -1,9 +1,16 @@ #pragma once +#include <vector> +#include <string> +#include <memory> +#include <map> + #include <SDL.h> -#include "Shader.hpp" -#include "RendererWorld.hpp" +#include "Utility.hpp" +#include "Renderer.hpp" + +class RendererWorld; class Render { SDL_Window *window; diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 76cef4e..0db23db 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -3,8 +3,6 @@ void RenderState::SetActiveVao(GLuint Vao) { glBindVertexArray(Vao); ActiveVao = Vao; - /*if (Vao != ActiveVao) { - }*/ } void RenderState::SetActiveShader(GLuint Shader) { diff --git a/src/Renderer.hpp b/src/Renderer.hpp index 306a310..ed3d1fa 100644 --- a/src/Renderer.hpp +++ b/src/Renderer.hpp @@ -1,7 +1,6 @@ #pragma once #include <GL/glew.h> -#include "Utility.hpp" class RenderState { GLuint ActiveVao = -1; diff --git a/src/RendererEntity.cpp b/src/RendererEntity.cpp index 0bc2606..951b1ad 100644 --- a/src/RendererEntity.cpp +++ b/src/RendererEntity.cpp @@ -1,5 +1,12 @@ #include "RendererEntity.hpp" +#include <glm/gtc/matrix_transform.hpp> +#include <glm/gtc/type_ptr.hpp> + +#include "Entity.hpp" +#include "World.hpp" +#include "Renderer.hpp" + const GLfloat vertices[] = { //Z+ edge -0.5f, 0.5f, 0.5f, diff --git a/src/RendererEntity.hpp b/src/RendererEntity.hpp index 578e24b..76548c6 100644 --- a/src/RendererEntity.hpp +++ b/src/RendererEntity.hpp @@ -1,12 +1,9 @@ #pragma once -#include <glm/glm.hpp> -#include <glm/gtc/matrix_transform.hpp> -#include <glm/gtc/type_ptr.hpp> +#include <GL/glew.h> -#include "Renderer.hpp" -#include "Entity.hpp" -#include "World.hpp" +class World; +class RenderState; class RendererEntity { unsigned int entityId; diff --git a/src/RendererSection.cpp b/src/RendererSection.cpp index 55761f7..6fed06f 100644 --- a/src/RendererSection.cpp +++ b/src/RendererSection.cpp @@ -1,6 +1,12 @@ #include "RendererSection.hpp" -#include <thread> +#include <easylogging++.h> +#include <glm/gtc/matrix_transform.hpp> + +#include "AssetManager.hpp" +#include "World.hpp" +#include "Section.hpp" +#include "Renderer.hpp" const GLfloat vertices[] = { 0, 0, 0, @@ -444,7 +450,7 @@ const BlockModel* RendererSectionData::GetInternalBlockModel(const BlockId& id) if (it.first == id) return it.second; } - idModels.push_back(std::make_pair(id, am.GetBlockModelByBlockId(id))); + idModels.push_back(std::make_pair(id, AssetManager::Instance().GetBlockModelByBlockId(id))); return idModels.back().second; } diff --git a/src/RendererSection.hpp b/src/RendererSection.hpp index 6745987..26068e4 100644 --- a/src/RendererSection.hpp +++ b/src/RendererSection.hpp @@ -1,17 +1,18 @@ #pragma once +#include <vector> +#include <array> + +#include <glm/mat4x4.hpp> #include <GL/glew.h> -#include <glm/detail/type_mat.hpp> -#include <glm/vec2.hpp> -#include <glm/detail/type_mat4x4.hpp> -#include <glm/gtx/transform.hpp> -#include <easylogging++.h> - -#include "AssetManager.hpp" -#include "Section.hpp" -#include "World.hpp" + #include "Vector.hpp" -#include "Renderer.hpp" +#include "Block.hpp" + +class BlockModel; +class AssetManager; +class World; +class RenderState; struct RendererSectionData { std::vector<glm::mat4> models; @@ -28,8 +29,6 @@ private: std::array<unsigned char, 16 * 16 * 16> GetBlockVisibilityData(World *world); - AssetManager& am = AssetManager::Instance(); - std::vector<std::pair<BlockId, const BlockModel *>> idModels; const BlockModel* GetInternalBlockModel(const BlockId& id); @@ -42,9 +41,7 @@ private: inline const BlockId& GetBlockId(int x, int y, int z) { return blockIdData[y * 256 +z * 16 + x]; - } - - + } }; diff --git a/src/RendererSky.cpp b/src/RendererSky.cpp index e0e367b..d0e9518 100644 --- a/src/RendererSky.cpp +++ b/src/RendererSky.cpp @@ -1,5 +1,8 @@ #include "RendererSky.hpp" +#include "Renderer.hpp" +#include "Utility.hpp" + const GLfloat vertices[] = { //Z+ edge -0.5f, -0.5f, 0.5f, diff --git a/src/RendererSky.hpp b/src/RendererSky.hpp index 4dd0892..8c6a409 100644 --- a/src/RendererSky.hpp +++ b/src/RendererSky.hpp @@ -1,11 +1,8 @@ #pragma once -#include <glm/glm.hpp> +#include <GL/glew.h> -#include "Utility.hpp" -#include "Shader.hpp" -#include "Renderer.hpp" -#include "AssetManager.hpp" +class RenderState; class RendererSky { GLuint VboVert, VboUv, Vao; diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp index ea27b47..0d5a7c7 100644 --- a/src/RendererWorld.cpp +++ b/src/RendererWorld.cpp @@ -1,6 +1,16 @@ #include "RendererWorld.hpp" + +#include <glm/gtc/matrix_transform.hpp> +#include <glm/gtc/type_ptr.hpp> + #include "DebugInfo.hpp" #include "Frustum.hpp" +#include "Event.hpp" +#include "AssetManager.hpp" +#include "Renderer.hpp" +#include "Shader.hpp" +#include "GameState.hpp" +#include "Section.hpp" void RendererWorld::WorkerFunction(size_t workerId) { EventListener tasksListener; @@ -87,14 +97,17 @@ void RendererWorld::UpdateAllSections(VectorF playerPos) } } -RendererWorld::RendererWorld(GameState* ptr):gs(ptr) { +RendererWorld::RendererWorld(GameState* ptr) { + gs = ptr; frustum = std::make_unique<Frustum>(); MaxRenderingDistance = 2; numOfWorkers = 2; + listener = std::make_unique<EventListener>(); + PrepareRender(); - listener.RegisterHandler(EventType::DeleteSectionRender, [this](EventData eventData) { + listener->RegisterHandler(EventType::DeleteSectionRender, [this](EventData eventData) { auto vec = std::get<DeleteSectionRenderData>(eventData).pos; sectionsMutex.lock(); auto it = sections.find(vec); @@ -106,7 +119,7 @@ RendererWorld::RendererWorld(GameState* ptr):gs(ptr) { sectionsMutex.unlock(); }); - listener.RegisterHandler(EventType::NewRenderDataAvailable,[this](EventData eventData) { + listener->RegisterHandler(EventType::NewRenderDataAvailable,[this](EventData eventData) { renderDataMutex.lock(); int i = 0; while (!renderData.empty() && i++ < 20) { @@ -137,7 +150,7 @@ RendererWorld::RendererWorld(GameState* ptr):gs(ptr) { renderDataMutex.unlock(); }); - listener.RegisterHandler(EventType::EntityChanged, [this](EventData eventData) { + listener->RegisterHandler(EventType::EntityChanged, [this](EventData eventData) { auto data = std::get<EntityChangedData>(eventData); for (unsigned int entityId : gs->world.GetEntitiesList()) { if (entityId == data.EntityId) { @@ -146,7 +159,7 @@ RendererWorld::RendererWorld(GameState* ptr):gs(ptr) { } }); - listener.RegisterHandler(EventType::ChunkChanged, [this](EventData eventData) { + listener->RegisterHandler(EventType::ChunkChanged, [this](EventData eventData) { auto vec = std::get<ChunkChangedData>(eventData).chunkPosition; Vector playerChunk(std::floor(gs->player->pos.x / 16), 0, std::floor(gs->player->pos.z / 16)); @@ -170,16 +183,16 @@ RendererWorld::RendererWorld(GameState* ptr):gs(ptr) { currentWorker = 0; }); - listener.RegisterHandler(EventType::UpdateSectionsRender, [this](EventData eventData) { + listener->RegisterHandler(EventType::UpdateSectionsRender, [this](EventData eventData) { UpdateAllSections(gs->player->pos); }); - listener.RegisterHandler(EventType::PlayerPosChanged, [this](EventData eventData) { + listener->RegisterHandler(EventType::PlayerPosChanged, [this](EventData eventData) { auto pos = std::get<PlayerPosChangedData>(eventData).newPos; UpdateAllSections(pos); }); - listener.RegisterHandler(EventType::ChunkDeleted, [this](EventData eventData) { + listener->RegisterHandler(EventType::ChunkDeleted, [this](EventData eventData) { auto pos = std::get<ChunkDeletedData>(eventData).pos; sectionsMutex.lock(); auto it = sections.find(pos); @@ -364,8 +377,8 @@ void RendererWorld::PrepareRender() { void RendererWorld::Update(double timeToUpdate) { static auto timeSincePreviousUpdate = std::chrono::steady_clock::now(); int i = 0; - while (listener.IsEventsQueueIsNotEmpty() && i++ < 50) - listener.HandleEvent(); + while (listener->IsEventsQueueIsNotEmpty() && i++ < 50) + listener->HandleEvent(); if (std::chrono::steady_clock::now() - timeSincePreviousUpdate > std::chrono::seconds(5)) { EventAgregator::PushEvent(EventType::UpdateSectionsRender, UpdateSectionsRenderData{}); timeSincePreviousUpdate = std::chrono::steady_clock::now(); diff --git a/src/RendererWorld.hpp b/src/RendererWorld.hpp index e7bd512..11a659b 100644 --- a/src/RendererWorld.hpp +++ b/src/RendererWorld.hpp @@ -1,19 +1,26 @@ #pragma once +#include <map> +#include <vector> +#include <mutex> +#include <queue> +#include <memory> + #include "RendererSection.hpp" #include "RendererEntity.hpp" #include "RendererSky.hpp" -#include "GameState.hpp" -#include "Shader.hpp" - -#include <glm/gtc/type_ptr.hpp> class Frustum; +class GameState; +class Texture; +class Shader; +class EventListener; +class RenderState; class RendererWorld { //General GameState *gs; - EventListener listener; + std::unique_ptr<EventListener> listener; size_t numOfWorkers; size_t currentWorker = 0; std::vector<std::thread> workers; diff --git a/src/Section.hpp b/src/Section.hpp index 41bef7b..e647600 100644 --- a/src/Section.hpp +++ b/src/Section.hpp @@ -2,14 +2,9 @@ #include <vector> #include <map> -#include <condition_variable> -#include <functional> - -#include <easylogging++.h> #include "Block.hpp" #include "Vector.hpp" -#include "Utility.hpp" class Section { std::vector<long long> block; diff --git a/src/Shader.cpp b/src/Shader.cpp index 164da69..d637c3b 100644 --- a/src/Shader.cpp +++ b/src/Shader.cpp @@ -1,5 +1,10 @@ #include "Shader.hpp" +#include <fstream> +#include <sstream> + +#include <easylogging++.h> + Shader::Shader(const GLchar *vertexPath, const GLchar *fragmentPath, const GLchar *geometryPath) { vertex = vertexPath; fragment = fragmentPath; diff --git a/src/Shader.hpp b/src/Shader.hpp index 17a434e..d6d59eb 100644 --- a/src/Shader.hpp +++ b/src/Shader.hpp @@ -1,10 +1,5 @@ #pragma once -#include <string> -#include <fstream> -#include <sstream> - -#include <easylogging++.h> #include <GL/glew.h> class Shader @@ -13,11 +8,8 @@ private: const GLchar *vertex; const GLchar *fragment; public: - // Идентификатор программы GLuint Program; - // Конструктор считывает и собирает шейдер Shader(const GLchar* vertexPath, const GLchar* fragmentPath, const GLchar* geometryPath = nullptr); - // Использование программы void Use(); void Reload(); diff --git a/src/Socket.cpp b/src/Socket.cpp index aea0c73..0effb3e 100644 --- a/src/Socket.cpp +++ b/src/Socket.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "Socket.hpp" #include <thread> diff --git a/src/Stream.cpp b/src/Stream.cpp index 6237451..8f5d519 100644 --- a/src/Stream.cpp +++ b/src/Stream.cpp @@ -1,5 +1,10 @@ #include "Stream.hpp" +#include <easylogging++.h> + +#include "Socket.hpp" +#include "Utility.hpp" + const int MAX_VARINT_LENGTH = 5; bool StreamInput::ReadBool() { diff --git a/src/Stream.hpp b/src/Stream.hpp index 3fb92df..b733d3b 100644 --- a/src/Stream.hpp +++ b/src/Stream.hpp @@ -1,19 +1,13 @@ #pragma once -#include <algorithm> -#include <string> -#include <stdexcept> #include <vector> -#include <cstring> -#include <nlohmann/json.hpp> -#include <easylogging++.h> - -#include "Socket.hpp" -#include "Vector.hpp" #include "Utility.hpp" +#include "Vector.hpp" #include "Chat.hpp" +class Socket; + struct SlotData { short BlockId = -1; signed char ItemCount = 1; diff --git a/src/Texture.cpp b/src/Texture.cpp index d39585f..5693682 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -2,6 +2,7 @@ #include <SDL.h> #include <SDL_image.h> +#include <easylogging++.h> bool IsImgInitialized = false; diff --git a/src/Texture.hpp b/src/Texture.hpp index 6b024d4..cda3e36 100644 --- a/src/Texture.hpp +++ b/src/Texture.hpp @@ -1,6 +1,7 @@ #pragma once -#include <easylogging++.h> +#include <string> + #include <GL/glew.h> class Texture { diff --git a/src/Thread.cpp b/src/Thread.cpp deleted file mode 100644 index 3ebc2c2..0000000 --- a/src/Thread.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Thread.hpp" diff --git a/src/Thread.hpp b/src/Thread.hpp deleted file mode 100644 index ddc0dc5..0000000 --- a/src/Thread.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -struct Thread { - Thread() = default; - virtual ~Thread() = default; - virtual void Execute() = 0; -};
\ No newline at end of file diff --git a/src/Utility.cpp b/src/Utility.cpp index 8be82d6..0fb10cf 100644 --- a/src/Utility.cpp +++ b/src/Utility.cpp @@ -1,6 +1,9 @@ -#include <thread> #include "Utility.hpp" +#include <thread> + +#include <easylogging++.h> + GLenum glCheckError_(const char *file, int line) { GLenum errorCode; while ((errorCode = glGetError()) != GL_NO_ERROR) { diff --git a/src/Utility.hpp b/src/Utility.hpp index 893f38e..e8c508d 100644 --- a/src/Utility.hpp +++ b/src/Utility.hpp @@ -3,8 +3,8 @@ #include <algorithm> #include <string> #include <chrono> +#include <vector> -#include <easylogging++.h> #include <GL/glew.h> using Uuid = std::vector<unsigned char>; diff --git a/src/Vector.hpp b/src/Vector.hpp index c89154f..0046b4a 100644 --- a/src/Vector.hpp +++ b/src/Vector.hpp @@ -2,7 +2,6 @@ #include <ostream> #include <cmath> -#include <tuple> #include <glm/vec3.hpp> diff --git a/src/Window.hpp b/src/Window.hpp index a6bccd9..94fdca3 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -1,6 +1,5 @@ #pragma once -#include <string> #include <queue> #include "Packet.hpp" diff --git a/src/World.cpp b/src/World.cpp index 7b150b7..c6f3fc8 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1,6 +1,12 @@ #include "World.hpp" + +#include <bitset> + +#include "Section.hpp" #include "Event.hpp" #include "DebugInfo.hpp" +#include "Packet.hpp" +#include "Collision.hpp" void World::ParseChunkData(std::shared_ptr<PacketChunkData> packet) { StreamBuffer chunkData(packet->Data.data(), packet->Data.size()); diff --git a/src/World.hpp b/src/World.hpp index 31290c8..c245947 100644 --- a/src/World.hpp +++ b/src/World.hpp @@ -1,20 +1,23 @@ #pragma once #include <map> -#include <bitset> #include <queue> #include <memory> +#include <vector> #include <easylogging++.h> - #include "Entity.hpp" #include "Block.hpp" -#include "Section.hpp" -#include "Packet.hpp" -#include "Collision.hpp" #include "Vector.hpp" +class Section; +class PacketChunkData; +class PacketBlockChange; +class PacketMultiBlockChange; +class PacketUnloadChunk; +class StreamInput; + class World { int dimension = 0; diff --git a/src/main.cpp b/src/main.cpp index 8c70bc8..2b213b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,8 @@ #include <set> +#include <easylogging++.h> + const char *getTimeSinceProgramStart(void) { static auto initialTime = std::chrono::steady_clock().now(); auto now = std::chrono::steady_clock().now(); |