You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/src/main.cpp

45 lines
1.3 KiB
C++

/******************************************************************************
* 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 <core/core.h>
#include <utils/logger.h>
#include <utils/helpers.h>
#include <iostream>
#include <filesystem>
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);
// All log messages will go to stdout
lunarium::Logger::GetInstance()->AddListener(new lunarium::StandardListener);
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;
}