-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrid.h
More file actions
34 lines (25 loc) · 876 Bytes
/
Grid.h
File metadata and controls
34 lines (25 loc) · 876 Bytes
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
#pragma once
#include "Tile.h"
#include <SFML/Graphics.hpp>
class Grid {
public:
Grid(int width, int height, int tileWidth);
void update();
void draw(sf::RenderWindow* window, const int fromX, const int toX, const int fromY, const int toY);
void changeTile(const int x, const int y, const sf::IntRect rect);
void changeTileColor(const int x, const int y, const sf::Color color);
void changeTileSprite(const int x, const int y, sf::Texture* texture);
void setSolid(const int x, const int y, const bool isSolid);
bool isSolid(const int x, const int y);
Tile* getTile(const int x, const int y);
sf::Vector2f getSize() const;
void resetNodes();
private:
std::vector<std::vector<Tile*>> tilemap;
std::vector<Tile*> solids;
int gridWidth;
int gridHeight;
int tileWidth;
sf::Texture tilesetTex;
sf::Sprite tileset;
};