/****************************************************************************** * File - main.cpp * Author - Joey Pollack * Date - 2021/09/03 (y/m/d) * Mod Date - 2021/09/03 (y/m/d) * Description - Main entry-point for Lunarium ******************************************************************************/ #include #include #include #include #include int main(int argc, char** argv) { // Switch the currrent working directory to the directory // containing the lunarium.exe file because the data and state // file should be in that location std::string path = argv[0]; path = lunarium::String::TrimFileNameFromPath(path); std::filesystem::current_path(path); // TODO: This could be made nicer... u32 ll = lunarium::LogLevel::FATAL_ERROR | lunarium::LogLevel::ERROR; #if LOG_LEVEL == 2 ll = lunarium::LogLevel::FATAL_ERROR | lunarium::LogLevel::ERROR | lunarium::LogLevel::WARNING | lunarium::LogLevel::INFO; #endif #if LOG_LEVEL == 3 ll = lunarium::LogLevel::ANY & ~(lunarium::LogLevel::GRAPHICS_INTERNAL_DEBUG | lunarium::LogLevel::GRAPHICS_INTERNAL_ERROR); #endif #if LOG_LEVEL == 4 ll = lunarium::LogLevel::ANY & ~(lunarium::LogLevel::GRAPHICS_INTERNAL_ERROR); #endif #if LOG_LEVEL == 5 ll = lunarium::LogLevel::ANY; #endif // All log messages will go to stdout lunarium::Logger::GetInstance()->AddListener(new lunarium::CoreLogListener( ll, lunarium::LogCategory::ANY)); lunarium::Core& core = lunarium::Core::GetInstance(); core.Initialize(argc, argv); if (!core.IsInit()) { std::cout << "\nFailed to initialize the engine core.\n"; return 1; } //std::cout << "\nEngine core successfully initialized!\n"; core.RunGameLoop(); core.Shutdown(); lunarium::Logger::GetInstance()->FreeAllListeners(); lunarium::Logger::FreeInstance(); std::cout << "\n"; return 0; }