-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelObject.cpp
More file actions
37 lines (31 loc) · 748 Bytes
/
Copy pathLevelObject.cpp
File metadata and controls
37 lines (31 loc) · 748 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
35
36
37
#include "LevelObject.h"
LevelObject::LevelObject(std::string path_, ObjectType type_, int x_, int y_, SDL_Rect srcRect_, std::string value_){
type = type_;
x = x_;
y = y_;
srcRect = srcRect_;
tileSetPath = path_;
value = value_;
}
ObjectType LevelObject::getType(){
return type;
}
void LevelObject::draw(SDL_Renderer* renderer, int tileWidth, int tileHeight){
SDL_Rect dstRect{
x: x,
y: y,
w: tileWidth,
h: tileHeight
};
Sprite sprite(tileSetPath.c_str(), renderer);
sprite.draw(renderer, &srcRect, &dstRect);
}
const int& LevelObject::getX(){
return x;
}
const int& LevelObject::getY(){
return y;
}
std::string LevelObject::getValue(){
return value;
}