diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-06-21 16:26:25 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-06-21 16:26:25 +0200 |
commit | f5aa7827af55342a1ec714d366944b3e3f3129b2 (patch) | |
tree | 4f4885d2ae0f46004a22e7d4dc34f80c11ecee0c /include/Core.hpp | |
parent | 2017-06-20 (diff) | |
download | AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar.gz AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar.bz2 AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar.lz AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar.xz AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.tar.zst AltCraft-f5aa7827af55342a1ec714d366944b3e3f3129b2.zip |
Diffstat (limited to 'include/Core.hpp')
-rw-r--r-- | include/Core.hpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/include/Core.hpp b/include/Core.hpp new file mode 100644 index 0000000..64fab4e --- /dev/null +++ b/include/Core.hpp @@ -0,0 +1,84 @@ +#pragma once + +#include <iomanip> +#include <tuple> + +#include <easylogging++.h> +#include <SFML/Window.hpp> +#include <GL/glew.h> +#include <glm/gtc/type_ptr.hpp> + +#include <GameState.hpp> +#include <AssetManager.hpp> +#include <graphics/Shader.hpp> +#include <graphics/Gui.hpp> +#include <graphics/RenderSection.hpp> +#include <network/NetworkClient.hpp> + +class Core { + GameState *gameState; + NetworkClient *client; + sf::Window *window; + AssetManager *assetManager; + bool isMouseCaptured = false; + bool isRunning = true; + enum { + MainMenu, + Loading, + Playing, + PauseMenu, + } currentState = Playing; + float mouseXDelta, mouseYDelta; + float deltaTime; + float absTime; + + void RenderWorld(); + + void HandleMouseCapture(); + + void HandleEvents(); + + void InitSfml(unsigned int WinWidth, unsigned int WinHeight, std::string WinTitle); + + void InitGlew(); + + void SetMouseCapture(bool IsCaptured); + + void PrepareToRendering(); + + void RenderFrame(); + + unsigned int width(); + + unsigned int height(); + + void UpdateChunksToRender(); + + void UpdateGameState(); + + std::thread gameStateLoopThread; + + Shader *shader; + //Cube verticies, Cube VAO, Cube UVs, TextureIndexes UboTextureIndexes, TextureData UboTextureIndexes, TextureData2 UboTextureIndexes, Blocks VBO, Models VBO, Line VAO, Lines VBO + //GLuint VBO, VAO, VBO2, UboTextureIndexes, UboTextureData, VBO3, VBO4, VAO2, VBO5; + GLuint UboTextureIndexes, UboTextureData; + //std::vector<Vector> toRender; + std::vector<Vector> toRender; + std::map<Vector, RenderSection> availableChunks; + + int ChunkDistance = 2; + + RenderState renderState; + + /*std::map<Vector, std::vector<glm::mat4>> toRenderModels; + std::map<Vector, std::vector<glm::vec2>> toRenderBlocks;*/ + + double tickRate = 0; + +public: + Core(); + + ~Core(); + + void Exec(); +}; |