summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-10-09 18:39:48 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:32 +0100
commita81bcb1942ddad5989115061338e72211443e633 (patch)
treecb1cc6feadb7dfb49f96cbc9b2a4f2bfb9ad8488 /src/main.cpp
parent2017-10-07 (diff)
downloadAltCraft-a81bcb1942ddad5989115061338e72211443e633.tar
AltCraft-a81bcb1942ddad5989115061338e72211443e633.tar.gz
AltCraft-a81bcb1942ddad5989115061338e72211443e633.tar.bz2
AltCraft-a81bcb1942ddad5989115061338e72211443e633.tar.lz
AltCraft-a81bcb1942ddad5989115061338e72211443e633.tar.xz
AltCraft-a81bcb1942ddad5989115061338e72211443e633.tar.zst
AltCraft-a81bcb1942ddad5989115061338e72211443e633.zip
Diffstat (limited to '')
-rw-r--r--src/main.cpp47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/main.cpp b/src/main.cpp
index aa7383d..8c70bc8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,8 +1,6 @@
#include "Event.hpp"
#include "Utility.hpp"
-#include "ThreadGame.hpp"
-#include "ThreadRender.hpp"
-#include "ThreadNetwork.hpp"
+#include "GlobalState.hpp"
#include <set>
@@ -17,24 +15,26 @@ const char *getTimeSinceProgramStart(void) {
INITIALIZE_EASYLOGGINGPP
+void initLogger() {
+ el::Configurations loggerConfiguration;
+ el::Helpers::installCustomFormatSpecifier(el::CustomFormatSpecifier("%startTime", std::bind(getTimeSinceProgramStart)));
+ std::string format = "[%startTime][%level][%thread][%fbase]: %msg";
+ loggerConfiguration.set(el::Level::Info, el::ConfigurationType::Format, format);
+ loggerConfiguration.set(el::Level::Error, el::ConfigurationType::Format, format);
+ loggerConfiguration.set(el::Level::Fatal, el::ConfigurationType::Format, format);
+ loggerConfiguration.set(el::Level::Warning, el::ConfigurationType::Format, format);
+ el::Helpers::setThreadName("Render");
+ el::Loggers::reconfigureAllLoggers(loggerConfiguration);
+ el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
+ LOG(INFO) << "Logger is configured";
+}
+
#undef main
int main(int argc, char** argv) {
srand(time(0));
- el::Configurations loggerConfiguration;
- el::Helpers::installCustomFormatSpecifier(
- el::CustomFormatSpecifier("%startTime", std::bind(getTimeSinceProgramStart)));
- std::string format = "[%startTime][%level][%thread][%fbase]: %msg";
- loggerConfiguration.set(el::Level::Info, el::ConfigurationType::Format, format);
- loggerConfiguration.set(el::Level::Error, el::ConfigurationType::Format, format);
- loggerConfiguration.set(el::Level::Fatal, el::ConfigurationType::Format, format);
- loggerConfiguration.set(el::Level::Warning, el::ConfigurationType::Format, format);
- el::Helpers::setThreadName("Render");
- el::Loggers::reconfigureAllLoggers(loggerConfiguration);
- el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
- LOG(INFO) << "Logger is configured";
-
- LOG(WARNING) << "Sizeof EventData is " << sizeof(EventData);
+ initLogger();
+ LOG(WARNING) << "Sizeof EventData is " << sizeof(EventData);
try {
if (SDL_Init(0) == -1)
@@ -44,16 +44,7 @@ int main(int argc, char** argv) {
return -1;
}
- ThreadGame game;
- std::thread threadGame(&ThreadGame::Execute, game);
-
- ThreadNetwork network;
- std::thread threadNetwork(&ThreadNetwork::Execute, network);
-
- ThreadRender render;
- render.Execute();
-
- threadGame.join();
- threadNetwork.join();
+ GlobalState::Exec();
+
return 0;
} \ No newline at end of file