mirror of
https://github.com/edubart/otclient.git
synced 2025-12-21 16:07:12 +01:00
* basic core design (Platform, Engine, Graphics classes)
* logger * x11 platform implementation
This commit is contained in:
39
src/main.cpp
Normal file
39
src/main.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "engine.h"
|
||||
#include "const.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <csignal>
|
||||
|
||||
// catches terminate signals to exit nicely
|
||||
void signal_handler(int sig)
|
||||
{
|
||||
switch(sig) {
|
||||
case SIGTERM:
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
{
|
||||
static bool stopping = false;
|
||||
if(!stopping) {
|
||||
stopping = true;
|
||||
g_engine.stop();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// install our signal handler
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGQUIT, signal_handler);
|
||||
|
||||
notice(APP_LONGNAME);
|
||||
|
||||
// setup the engine and run
|
||||
g_engine.init();
|
||||
g_engine.run();
|
||||
g_engine.terminate();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user