-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.cpp
More file actions
65 lines (54 loc) · 1.38 KB
/
Application.cpp
File metadata and controls
65 lines (54 loc) · 1.38 KB
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
62
63
64
65
#include "Application.hpp"
#include "WindowSystem/WindowManager.hpp"
#include "GameSystem/MapSystem/World.hpp"
#include "WindowSystem/Screens/GuiIngame.hpp"
float Application::DELTA_TIME;
Application* Application::APP;
Application::Application(int windowWidth, int windowHeight, std::string windowName)
{
Application::APP = this;
m_running = true;
m_pause = false;
m_windowManager = new WindowManager(this, windowWidth, windowHeight, windowName);
theWorld= nullptr;
}
Application::~Application()
{
}
void Application::run()
{
m_clock.restart();
while(m_running)///Boucle principale
{
m_windowManager->checkEvents();///Boucle d'evennement
if(!m_pause)
{
m_windowManager->clear();///nettoie la fenetre
m_windowManager->updateWindow();///met a jour la fenetre et dessine l'écran actuel
m_windowManager->display();///affiche le contenue du buffer de dessin
}
Application::DELTA_TIME = m_clock.restart().asSeconds();
}
}
void Application::start()
{
theWorld = new World();
theWorld->loadFromFile("level-0.xml");
m_windowManager->displayScreen(new GuiIngame(theWorld));
}
void Application::stop()
{
m_running = false;
}
void Application::pause()
{
m_pause = true;
}
void Application::resume()
{
m_pause = false;
}
bool Application::isPaused()const
{
return m_pause;
}