-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
executable file
·72 lines (57 loc) · 1.77 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
65
66
67
68
69
70
71
72
/**
* Application Main
* eMorrisGUI
*
* @author Tibor Buzási <develop@tiborbuzasi.com>
*
* Copyright © 2020 Tibor Buzási. All rights reserved.
* For licensing information see LICENSE in the project root folder.
*/
#include "Main.hpp"
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include "engine/graphics/GraphicsHandler.hpp"
#include "engine/graphics/DrawFunctions.hpp"
#include "engine/input/InputFunctions.hpp"
#include "engine/objects/ObjectFunctions.hpp"
#include "engine/resources/ResourceFunctions.hpp"
#include "engine/UtilityFunctions.hpp"
#include "AppInfo.hpp"
#include "objects/MenuController.hpp"
int main(int argc, char **argv)
{
// Display application name and version
std::cout << APP_NAME << " - Version " << APP_VERSION << std::endl << std::endl;
// Initalize the resource manager, interface manager and object manager
im = new InterfaceManager();
rm = new ResourceManager();
om = new ObjectManager(im);
// Initialize SDL system and create window
if (!rm->LoadResource("Settings"))
exit(1);
im->Initialize(rm);
// Initialize the drawing, input, object and resource functions
draw::Initialize(im->GetGraphicsHandler());
input::Initialize(im->GetInputHandler());
obj::Initialize(om);
res::Initialize(rm);
std::cout<<std::endl;
// Create objects
om->CreateObject(new MenuController("controllers", "MenuController"));
// Wait for input
std::cout << "Waiting for user interaction..." << std::endl;
// Loop
while (!im->CheckQuit())
{
im->GetInputHandler()->Input();
om->Update();
om->Draw();
im->GetGraphicsHandler()->Render();
}
delete om;
delete im;
delete rm;
return 0;
}