summaryrefslogtreecommitdiffstats
path: root/Display.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-21 15:31:43 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-04-21 15:31:43 +0200
commit71760514fc044f273914c17b1510fa3cf10419b3 (patch)
tree72f822efde300d8e1e9de1cc578d431ff72e0e03 /Display.hpp
parent2017-04-15 (diff)
downloadAltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.gz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.bz2
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.lz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.xz
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.tar.zst
AltCraft-71760514fc044f273914c17b1510fa3cf10419b3.zip
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();
};