-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.cpp
More file actions
27 lines (25 loc) · 704 Bytes
/
item.cpp
File metadata and controls
27 lines (25 loc) · 704 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
#include "item.h"
void Item::draw() const {
sprite->draw(getX(), getY(), getScale());
}
void Item::update(Uint32 ticks) {
ellapsed_time += ticks;
}
int Item::getScaledWidth() const {
return getScale() * sprite->getWidth();
}
int Item::getScaledHeight() const {
return getScale() * sprite->getHeight();
}
const Image* Item::getImage() const {
return sprite;
}
const SDL_Surface* Item::getSurface() const {
return sprite->getSurface();
}
Item::Item(std::string tag, int row, int col, int s) :
Drawable(tag, Vector2f(row * s, col * s), Vector2f(0, 0), 1.0),
sprite (ImageFactory::getInstance().getImage(tag)),
ellapsed_time(0) {}
/* Responsible for freeing sprite. */
Item::~Item() {}