-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.h
More file actions
72 lines (53 loc) · 1.37 KB
/
Tile.h
File metadata and controls
72 lines (53 loc) · 1.37 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
71
#pragma once
#include "Entity.h"
enum class TileTypes
{
Default = 0,
Damaging,
Doodad,
EnemySpawner,
TILE_TYPES_MAX = EnemySpawner
//And so on...
};
class Tile
{
private:
protected:
sf::Sprite shape;
int type;
bool collision;
bool captured;
bool showCaptured;
bool available;
bool showAvailable;
public:
// Constructors and Destructor:
Tile();
Tile
(
int type,
int grid_x, int grid_y, float grid_size_f,
const sf::Texture& texture, const sf::IntRect& texture_rect,
const bool collision
);
virtual ~Tile();
// Accessors:
const bool& isCaptured() const;
const bool& isAvailable() const;
const int& getType() const;
const bool& getCollision() const;
const sf::Vector2f getPosition() const;
const sf::Vector2f getCenter() const;
const sf::FloatRect getGlobalBounds() const;
const float getDistance(const Entity* entity) const;
// Modifiers:
void setCaptured(const bool captured = true);
void setShowCaptured(const bool show_captured = true);
void setAvailable(const bool available = true);
void setShowAvailable(const bool show_available = true);
// Fuctions:
const bool intersects(const sf::FloatRect bounds) const;
virtual const std::string getAsString() const = 0;
virtual void update(const float& dt) = 0;
virtual void render(sf::RenderTarget* target, sf::Shader* shader = nullptr, const sf::Vector2f player_position = sf::Vector2f()) = 0;
};