-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.hpp
More file actions
70 lines (65 loc) · 1.97 KB
/
map.hpp
File metadata and controls
70 lines (65 loc) · 1.97 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef MAP_HPP
#define MAP_HPP
#include <iostream>
#include "tile.hpp"
#include "constants.hpp"
#include "room.hpp"
#include "entity.hpp"
#include "bounds_check.hpp"
#include "point.hpp"
class Map {
friend class WorldGenerator;
friend class XmlLoader;
private:
int** tiles;
int** colorize; // Flag that tells if the tile is supposed to be colorized prior to rendering
int** rooms;
bool** tasked; // Flag that tells if the tile has an associated task
bool** walkable;
std::vector<Tile*> tileDict;
std::vector<sf::Color> colorDict;
std::vector<Room*> roomDict;
std::vector<Material*> matDict;
sf::RenderTexture mapTex;
sf::Sprite mapSpr;
bool dirty;
Entity*** ents;
protected:
void addTile(Tile* tileToAdd);
void addColor(sf::Color colorToAdd);
void addRoom(Room* roomToAdd);
void addMaterial(Material* matToAdd);
public:
int width, height;
static point TexXYToTileXY(float texX, float texY);
static point TileXYToTexXY(int x, int y);
Map();
~Map();
void init(int width, int height);
void update(float dt);
void render(sf::RenderTarget* screen);
void reRender();
void setTile(int x, int y, Tile* tileToAdd);
void setTile(int x, int y, int tileToAdd);
Tile* getTile(int x, int y);
void setColor(int x, int y, sf::Color colorToAdd);
void setColor(int x, int y, int colorToAdd);
void setRoom(int x, int y, Room* roomToAdd);
void setRoom(int x, int y, int roomToAdd);
void setRoom(int x0, int y0, int x1, int y1, int roomToAdd);
void setRoom(int x0, int y0, int x1, int y1, Room* roomToAdd);
int getRoomID(Room* room);
int getTileID(Tile* tile);
void setTasked(int x, int y, bool tasked);
bool getTasked(int x, int y);
bool isWalkable(int x, int y);
void resetWalkableStatus(int x, int y);
void setWalkableStatus(int x, int y, bool status);
//void moveEnt(int oldX, int oldY)
//Entity* getEnts(int x, int y);
Tile* getRoom(int x, int y);
void clearColor(int x, int y);
bool inBounds(int x, int y);
std::vector<Tile*> getTileDict(){ return tileDict; };
};
#endif