-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScreenManager.h
61 lines (52 loc) · 1.42 KB
/
ScreenManager.h
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
53
54
55
56
57
58
59
60
61
#pragma once
#include <SFML/Graphics.hpp>
#include <map>
#include "GameScreen.h"
#include "ScreenManagerRemoteControl.h"
#include "SelectScreen.h"
#include "LevelManager.h"
#include "BitmapStore.h"
#include <iostream>
using namespace sf;
using namespace std;
class ScreenManager : public ScreenManagerRemoteControl {
private:
map <string, unique_ptr<Screen>> m_Screens;
LevelManager m_LevelManager;
protected:
string m_CurrentScreen = "Select";
public:
BitmapStore m_BS;
ScreenManager(Vector2i res);
void update(float fps);
void draw(RenderWindow& window);
void handleInput(RenderWindow& window);
/****************************************************
*****************************************************
From ScreenManagerRemoteControl interface
*****************************************************
*****************************************************/
void ScreenManagerRemoteControl::
SwitchScreens(string screenToSwitchTo)
{
m_CurrentScreen = "" + screenToSwitchTo;
m_Screens[m_CurrentScreen]->initialise();
}
void ScreenManagerRemoteControl::
loadLevelInPlayMode(string screenToLoad)
{
m_LevelManager.getGameObjects().clear();
m_LevelManager.
loadGameObjectsForPlayMode(screenToLoad);
SwitchScreens("Game");
}
vector<GameObject>&
ScreenManagerRemoteControl::getGameObjects()
{
return m_LevelManager.getGameObjects();
}
GameObjectSharer& shareGameObjectSharer()
{
return m_LevelManager;
}
};