-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScreen.cpp
48 lines (40 loc) · 855 Bytes
/
Screen.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
#include "Screen.h"
void Screen::initialise() {}
void Screen::addPanel(unique_ptr<UIPanel> uip,
ScreenManagerRemoteControl* smrc,
shared_ptr<InputHandler> ih)
{
ih->initialiseInputHandler(smrc,
uip->getButtons(), &uip->m_View, this);
// Use move() because otherwise
// the vector has a COPY which is not allowed
m_Panels.push_back(move(uip));
m_InputHandlers.push_back(ih);
}
void Screen::handleInput(RenderWindow& window)
{
Event event;
auto itr = m_InputHandlers.begin();
auto end = m_InputHandlers.end();
while (window.pollEvent(event))
{
for (itr;
itr != end;
++itr)
{
(*itr)->handleInput(window, event);
}
}
}
void Screen::update(float fps) {}
void Screen::draw(RenderWindow& window)
{
auto itr = m_Panels.begin();
auto end = m_Panels.end();
for (itr;
itr != end;
++itr)
{
(*itr)->draw(window);
}
}