-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathapplication.hpp
More file actions
69 lines (68 loc) · 2.8 KB
/
application.hpp
File metadata and controls
69 lines (68 loc) · 2.8 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
66
67
68
69
#pragma once
#include <fea/config.hpp>
#include <vector>
#include <string>
namespace fea
{
class FEA_API Application
{
public:
Application();
virtual ~Application() {}
void run(int argc = 0, char** argv = nullptr);
void quit();
virtual void loop() = 0;
bool shuttingDown();
protected:
virtual void setup(const std::vector<std::string>& args);
private:
bool mShutDown;
};
/** @addtogroup Structure
*@{
* @class Application
*@}
***
* @class Application
* @brief Base class for the main application.
*
* The purpose of this class is to have a standard way of creating and running an application. It manages everything in the application on the top most level. Would typically contain a GameStateMachine which in turn contains all states of the game. It is responsible for setting up and destroying things needed in general by the application.
*
* Using this method, a typical main function running the application would look like this:
* @code
* int main()
* {
* ApplicationImplementation superGame;
*
* superGame.run();
* }
* @endcode
***
* @fn void Application::run()
* @brief Run main loop of the application.
*
* This function runs the main loop. When called, the main loop will be looping until Application::quit is called. The logic of the main loop is defined by inheriting from Application::loop.
***
* @fn void Application::quit()
* @brief Call this function to request the application to shut down.
*
* After this function is called, it will leave the main loop after the current iteration is finished.
***
* @fn virtual void Application::setup(const std::vector<std::string>& args) = 0
* @brief Run setup procedures for the application.
*
* This function is automatically called once before it starts looping the Application::loop() function when Application::run() is called. The string vector passed to the function contains the command line arguments passed to the executable.
* @param args Vector with command line arguments.
***
* @fn virtual void Application::loop() = 0
* @brief Iterate the main loop.
*
* The application is given its logic by implementing this function. It is not meant to be called directly, instead it will automatically be called over and over, from Application::run.
***
* @fn bool Application::shuttingDown()
* @brief Check if the application is under the process of shutting down.
*
* If the appication is shutting down, the current frame will be the last one.
* @return True if the application is shutting down.
***/
}