-
Notifications
You must be signed in to change notification settings - Fork 0
/
Projector.cpp
49 lines (41 loc) · 1.19 KB
/
Projector.cpp
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
#include "Projector.h"
#include "Beginning.h"
#include "Level01.h"
#include "Level02.h"
#include "End.h"
#include "Logger.h"
#include "Chaos.h"
#include "Classic.h"
#include "BetweenLevels.h"
Projector::Projector() : sprites(Sprites::get())
{
Logger::get() << "Initializing projector...\n";
this->slides.emplace(SlideType::beginning, std::make_unique<Beginning>());
this->slides.emplace(SlideType::level01, std::make_unique<Level01>());
this->slides.emplace(SlideType::betweenLevels, std::make_unique<BetweenLevels>());
this->slides.emplace(SlideType::level02, std::make_unique<Level02>());
this->slides.emplace(SlideType::end, std::make_unique<End>());
}
SlideType Projector::getActiveSlide()
{
return this->activeSlide;
}
void Projector::reset()
{
for (auto& slide : slides)
{
slide.second->reset();
}
}
void Projector::tick(const Time time)
{
auto search = this->slides.find(this->activeSlide);
search->second->tick(time);
auto newSlide = search->second->getNextSlide();
if (newSlide != this->activeSlide)
{
auto search = this->slides.find(newSlide);
search->second->reset();
this->activeSlide = newSlide;
}
}