-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageGC.cpp
More file actions
32 lines (25 loc) · 744 Bytes
/
ImageGC.cpp
File metadata and controls
32 lines (25 loc) · 744 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
#include "ImageGC.h"
ImageGC::ImageGC() :
texture_(nullptr), clip_() {
}
ImageGC::ImageGC(Texture* texture) :
ImageGC(texture, { 0, 0, texture->getWidth(), texture->getHeight() }) {
}
ImageGC::ImageGC(Texture* texture, SDL_Rect clip) :
texture_(texture), clip_(clip) {
}
ImageGC::~ImageGC() {
}
void ImageGC::render(Container* c, Uint32 time) {
SDL_Rect dest = RECT(c->getPosition().getX(), c->getPosition().getY(),
c->getWidth(), c->getHeight());
texture_->render(dest, c->getRotation(), &clip_);
}
void ImageGC::setTexture(Texture* texture) {
texture_ = texture;
clip_ = {0, 0, texture->getWidth(), texture->getHeight()};
}
void ImageGC::setTexture(Texture* texture, SDL_Rect clip) {
texture_ = texture;
clip_ = clip;
}