blob: fe495a1984f35342b08d16ed9213ed1a79338630 (
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
|
#include <cmath>
#include <utility>
#include "../util/Log.h"
#include "Component.h"
#include "Sprite.h"
#include "Texture.h"
#include "types.h"
using namespace std;
using namespace crepe;
Sprite::Sprite(game_object_id_t id, Texture & texture, const Sprite::Data & ctx)
: Component(id),
texture(std::move(texture)),
data(ctx) {
dbg_trace();
this->mask.w = this->texture.get_width();
this->mask.h = this->texture.get_height();
this->data.aspect_ratio = static_cast<double>(this->mask.w) / this->mask.h;
}
Sprite::~Sprite() { dbg_trace(); }
|