aboutsummaryrefslogtreecommitdiff
path: root/src/example/rendering.cpp
blob: 9ca12b7b75db9e59eb50c2587d762d091f96bb74 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <crepe/util/log.h>
#include <crepe/GameObject.h>
#include <crepe/ComponentManager.h>
#include <crepe/RenderSystem.h>


#include <crepe/api/Color.h>
#include <crepe/api/Sprite.h>
#include <crepe/api/Texture.h>
#include <crepe/api/Transform.h>
#include <crepe/api/Point.h>


#include <memory>
#include <chrono>


using namespace std;
using namespace crepe;
using namespace crepe::api;

int main(){

	dbg_trace();


	auto obj = GameObject(0, "name" , "tag", 0);

	Color color(0,0,0,0);
	//Sprite sprite(std::move(texture), color, {false,false});

	Point point = {
		.x = 0,
		.y = 0,
	};

	obj.add_component<Transform>(point, 0 ,1);
	obj.add_component<Sprite>(make_unique<Texture>("../asset/texture/img.png"),color, flip_settings{false,false});

	auto& sys = crepe::RenderSystem::get_instance();

	// scene example
	auto start = std::chrono::steady_clock::now();
    while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) {
		sys.update();
    }

}