aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Sprite.cpp
blob: 291985706c53604247fbfe0b449b9427d7f2a032 (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
31
32
33
34
35
36
#include <cmath>

#include "../util/dbg.h"
#include "api/Asset.h"

#include "Component.h"
#include "Sprite.h"
#include "types.h"

using namespace std;
using namespace crepe;

Sprite::Sprite(game_object_id_t id, const Asset & texture, const Sprite::Data & data)
	: Component(id),
	  source(texture),
	  data(data) {

	dbg_trace();
}

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

unique_ptr<Component> Sprite::save() const {
	return unique_ptr<Component>(new Sprite(*this));
}

void Sprite::restore(const Component & snapshot) {
	*this = static_cast<const Sprite &>(snapshot);
}

Sprite & Sprite::operator=(const Sprite & snapshot) {
	this->active = snapshot.active;
	this->data = snapshot.data;
	this->mask = snapshot.mask;
	return *this;
}