aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Sprite.cpp
blob: 0a2ad4cc8669886fc61cc394900a1043d3d4f179 (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
28
29
30
#include <cmath>
#include <utility>

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

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

using namespace std;
using namespace crepe;

Sprite::Sprite(game_object_id_t id, Texture & image, const Color & color,
			   const FlipSettings & flip, int sort_layer, int order_layer, int height)
	: Component(id),
	  color(color),
	  flip(flip),
	  sprite_image(std::move(image)),
	  sorting_in_layer(sort_layer),
	  order_in_layer(order_layer),
	  height(height) {

	dbg_trace();

	this->mask.w = sprite_image.get_size().x;
	this->mask.h = sprite_image.get_size().y;
	this->aspect_ratio = static_cast<double>(this->mask.w) / this->mask.h;
}

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