blob: d7a9089142a2fbd5917da4d4b212b7173ff87e9d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#pragma once
#include <SFML/Graphics.hpp>
#include <thread>
#include <mutex>
#include <condition_variable>
#include "World.hpp"
class Display {
sf::RenderWindow *window;
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, int h, std::string title, World *world, std::condition_variable &gameStartWaiter);
~Display();
bool IsClosed();
void SetPlayerPos(float x, float z);
void MainLoop();
};
|