summaryrefslogtreecommitdiffstats
path: root/include/Core.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-29 16:55:16 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-07-29 16:55:16 +0200
commitf942405184c2d6067fb5303b58a225edf7e452b1 (patch)
tree83e70c7e3019e5b195c9caf41194b2113fa76d7f /include/Core.hpp
parent2017-07-26 (diff)
downloadAltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.gz
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.bz2
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.lz
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.xz
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.tar.zst
AltCraft-f942405184c2d6067fb5303b58a225edf7e452b1.zip
Diffstat (limited to 'include/Core.hpp')
-rw-r--r--include/Core.hpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/include/Core.hpp b/include/Core.hpp
new file mode 100644
index 0000000..3cad094
--- /dev/null
+++ b/include/Core.hpp
@@ -0,0 +1,79 @@
+#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 UboTextureIndexes, UboTextureData;
+ std::vector<Vector> toRender;
+ std::map<Vector, RenderSection> availableChunks;
+
+ int ChunkDistance = 1;
+
+ RenderState renderState;
+
+ double tickRate = 0;
+
+public:
+ Core();
+
+ ~Core();
+
+ void Exec();
+};