Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1#include <csignal>
2#include <iostream>
3
4#include "core/App.hpp"
5
6volatile sig_atomic_t g_interrupted = 0;
7
8static void onInterrupt(int) { g_interrupted = 1; }
9
10int main(int argc, char** argv)
11{
12 signal(SIGPIPE, SIG_IGN);
13 signal(SIGINT, onInterrupt);
14 signal(SIGTERM, onInterrupt);
15
16 App app(argc, argv);
17
18 if (!app.shouldRun()) {
19 return app.exitCode();
20 }
21
22 try {
23 app.run();
24 } catch (const std::exception& e) {
25 std::cerr << "[Fatal] " << e.what() << "\n";
26 return 1;
27 } catch (...) {
28 std::cerr << "[Fatal] Unknown exception\n";
29 return 1;
30 }
31 return 0;
32}
The main application class that manages the game state, network communication, and rendering....
Definition App.hpp:17
bool shouldRun() const
Checks if the application should run based on the parsed arguments.
Definition App.cpp:24
int exitCode() const
Gets the exit code to return if the application should not run.
Definition App.cpp:26
void run()
Runs the application.
Definition App.cpp:28
volatile sig_atomic_t g_interrupted
Definition main.cpp:6
int main(int argc, char **argv)
Definition main.cpp:10
static void onInterrupt(int)
Definition main.cpp:8