/
SFMLApp.h
52 lines (40 loc) · 982 Bytes
/
SFMLApp.h
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
45
46
47
48
49
50
51
52
#ifndef SFMLAPP_H
#define SFMLAPP_H
#include "SFML/Graphics/RenderWindow.hpp"
#include "SFML/Graphics/View.hpp"
#include "SFML/Window/Event.hpp"
#include "SFML/System/Time.hpp"
#include "TextureManager.h"
#include "Map.h"
#include "MapGenerator.h"
#include "Entity.h"
class SFMLApp {
private:
bool running;
bool viewKeys[4];
bool moveKeys[4];
sf::RenderWindow* window;
sf::View* viewport;
TextureManager textureManager;
Map* currentMap;
Entity* player;
bool moved;
public:
static const int WINDOW_WIDTH = 1024;
static const int WINDOW_HEIGHT = 768;
SFMLApp();
virtual ~SFMLApp();
// SFML Specific
bool Init(const char * title = "SFML App");
void HandleEvent(sf::Event* event);
void Update(sf::Time elapsedTime);
void Render();
void Cleanup();
int Execute();
void LoadTextures();
// Other
void SetViewportFocus(sf::Vector2f center);
void SetViewportZoom(float factor);
bool CheckValidMove(int rOff, int cOff);
};
#endif