-
Notifications
You must be signed in to change notification settings - Fork 0
/
Elements.hpp
66 lines (52 loc) · 1.26 KB
/
Elements.hpp
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
#pragma once
#include "SDL.h"
class TextureWrapper;
#include "Height.hpp"
#include "Wrappers.hpp"
// TODO: Assign a unique ID to each GameElement to allow for proper searching and identification
// TODO: Merge GameEleent and TextureElement - graphics are text-based anyway
class GameElement
{
public:
virtual void update();
virtual void render();
const int getX() const;
const int getY() const;
const bool isPlayable() const;
const Height getHeight() const;
char getSymbol();
void setXY(int x, int y);
protected:
GameElement(int x, int y, bool playable, Height height, char symbol, std::unique_ptr<TextureWrapper> texture);
int x;
int y;
bool playable;
Height height;
char symbol;
std::unique_ptr<TextureWrapper> texture;
// SDL_Rect specifying dimensions of the image
SDL_Rect srcRect;
// SDL_Rect specifying location + dimensions of rendering
SDL_Rect dstRect;
};
class ImageElement : public GameElement
{
protected:
ImageElement(const char* texturePath, int x, int y);
};
class TextElement : public GameElement
{
protected:
TextElement(int x, int y, bool playable, Height height, char symbol);
};
class Player : public TextElement
{
public:
Player(int x, int y);
void update();
};
class Tile : public TextElement
{
public:
Tile(int x, int y);
};