forked from plastictown/Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.cpp
More file actions
42 lines (35 loc) · 717 Bytes
/
Copy pathengine.cpp
File metadata and controls
42 lines (35 loc) · 717 Bytes
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
/*
* https://github.com/plastictown/Engine
* Copyright (C) 2018 Mikhail Domchenkov
*/
#include <engine.h>
Engine::Engine(int argc, char** argv):
render(argc, argv)
{
scene=make_shared<Scene>();
render.SetScene(scene);
}
void Engine::Run()
{
Render::run();
}
Image Engine::LoadImage(const string& filename)
{
Image im;
if(!im.load(filename))
throw runtime_error(string("can't load image: ") + filename);
return im;
}
uint32_t Engine::AddObject(shared_ptr<GameObject>&& obj)
{
return scene->AddObject(obj);
}
void Engine::RemoveObject(uint32_t key)
{
scene->RemoveObject(key);
}
void Engine::SetScene(shared_ptr<Scene>&& scn)
{
scene = std::move(scn);
render.SetScene(scene);
}