-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
64 lines (51 loc) · 1.31 KB
/
Main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Author: Annie Berend (5033782) - Jonathan Verbeek (5058288)
#include "Main.h"
#include <QApplication>
#include <QDebug>
// Singleton instance definition
CMain* CMain::singletonInstance = nullptr;
int CMain::run(int argc, char* argv[])
{
// Create a new QApplication instance
QApplication app(argc, argv);
// Set the applications icon
app.setWindowIcon(QIcon(":/assets/icon.png"));
// Assign the singleton instance
singletonInstance = this;
// Create the game window
gameWindow = new CGameWindow();
gameWindow->show();
// Create the game instance
gameInstance = new CGame();
// Create the sound manager instance
soundManager = new CSoundManager();
// Run the app loop
return app.exec();
}
CMain* CMain::get()
{
// Return the singleton instance
return singletonInstance;
}
CGameWindow* CMain::getGameWindow() const
{
// Return the game window instance
return gameWindow;
}
CGame* CMain::getGameInstance() const
{
// Returns the game instance
return gameInstance;
}
CSoundManager *CMain::getSoundManager() const
{
// Returns the sound manager
return soundManager;
}
// Applications entry point
int main(int argc, char* argv[])
{
// Create a new CMain and run it
CMain* main = new CMain();
return main->run(argc, argv);
}