aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Sprite.cpp
blob: 27f219ca15f9ac19a3029bb965a6de37fa27d5e2 (plain)
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 <cmath>
#include <memory>

#include "../util/Log.h"
#include "facade/SDLContext.h"

#include "Component.h"
#include "Sprite.h"
#include "Texture.h"

using namespace std;
using namespace crepe;

Sprite::Sprite(game_object_id_t id, const shared_ptr<Texture> image, const Color & color,
			   const FlipSettings & flip)
	: Component(id),
	  color(color),
	  flip(flip),
	  sprite_image(image),
	  aspect_ratio(static_cast<double>(sprite_image->get_width()) / sprite_image->get_height()) {
	dbg_trace();

	this->sprite_rect.w = sprite_image->get_width();
	this->sprite_rect.h = sprite_image->get_height();
}

Sprite::~Sprite() { dbg_trace(); }