summaryrefslogtreecommitdiffstats
path: root/Display.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Display.hpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/Display.hpp b/Display.hpp
index bb1f946..d7a9089 100644
--- a/Display.hpp
+++ b/Display.hpp
@@ -1,17 +1,44 @@
#pragma once
#include <SFML/Graphics.hpp>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
#include "World.hpp"
class Display {
sf::RenderWindow *window;
- World* world;
+ std::map<PositionI, std::array<sf::Texture,16>> sectionTextures;
+ World *world;
+ bool isGameStarted = false;
+ std::condition_variable &gameStartWaiter;
+ std::mutex gameStartMutex;
+
+ //utility methods
+ void pollEvents();
+
+ void renderWorld();
+
+ void Update();
+
+ sf::Texture &GetSectionTexture(PositionI pos);
+
+ //gameState vars
+ sf::Vector2f mousePos;
+ int renderLayer = 70;
+ //int currentId = 0;
+ bool isClicked = false;
+ int coeff = 10;
+ double frameTime = 0;
public:
- Display(int w=1280,int h=720,std::string title="AltCraft");
+ Display(int w, int h, std::string title, World *world, std::condition_variable &gameStartWaiter);
+
~Display();
- void SetWorld(World* wrd);
- void Update();
+
bool IsClosed();
+
void SetPlayerPos(float x, float z);
+
+ void MainLoop();
};