|
|
|
@ -56,7 +56,7 @@ namespace lunarium
|
|
|
|
if (!mpInstance)
|
|
|
|
if (!mpInstance)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!");
|
|
|
|
Logger::Info(LogCategory::CORE, "Lunarium is shutting down!");
|
|
|
|
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
int x, y;
|
|
|
|
mpInstance->MainWindow().GetPosition(&x, &y);
|
|
|
|
mpInstance->MainWindow().GetPosition(&x, &y);
|
|
|
|
@ -123,32 +123,36 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mErrorLogFile.open("Lunarium_Errors.log", std::ios_base::app);
|
|
|
|
mErrorLogFile.open("Lunarium_Errors.log", std::ios_base::app);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mGraphicsLogFile.open("Lunarium_Graphics.log", std::ios_base::app);
|
|
|
|
mErrorLogFile << "\n\n";
|
|
|
|
mErrorLogFile << "\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
if (mMasterLogFile.is_open())
|
|
|
|
if (mMasterLogFile.is_open())
|
|
|
|
Logger::GetInstance()->AddListener(new FileListener(mMasterLogFile));
|
|
|
|
Logger::GetInstance()->AddListener(new FileListener(mMasterLogFile));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mErrorLogFile.is_open())
|
|
|
|
if (mErrorLogFile.is_open())
|
|
|
|
Logger::GetInstance()->AddListener(new FileListener(mErrorLogFile, LogLevel::ERROR | LogLevel::FATAL_ERROR));
|
|
|
|
Logger::GetInstance()->AddListener(new FileListener(mErrorLogFile, LogLevel::ERROR | LogLevel::FATAL_ERROR));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGraphicsLogFile.is_open())
|
|
|
|
|
|
|
|
Logger::GetInstance()->AddListener(new FileListener(mGraphicsLogFile, LogLevel::GRAPHICS_INTERNAL_DEBUG | LogLevel::GRAPHICS_INTERNAL_ERROR));
|
|
|
|
|
|
|
|
|
|
|
|
Logger::GetInstance()->SetAllowRepeats(true);
|
|
|
|
Logger::GetInstance()->SetAllowRepeats(true);
|
|
|
|
|
|
|
|
|
|
|
|
// Init the Debug log window
|
|
|
|
// Init the Debug log window
|
|
|
|
OpRes result;
|
|
|
|
OpRes result;
|
|
|
|
mPanelIDs.CoreConsole = AddPanel(new CoreConsole);
|
|
|
|
mPanelIDs.CoreConsole = AddPanel(new CoreConsole);
|
|
|
|
|
|
|
|
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running Lunarium version %s", Version::GetVersion().ToString().c_str());
|
|
|
|
Logger::Info(LogCategory::CORE, "Running Lunarium version %s", Version::GetVersion().ToString().c_str());
|
|
|
|
|
|
|
|
|
|
|
|
// Attempt to load the engine state file. This file should be placed in the same directory as the lunarium program.
|
|
|
|
// Attempt to load the engine state file. This file should be placed in the same directory as the lunarium program.
|
|
|
|
if (Failed(State::CreateFromFile("engine_state.xml", mState)))
|
|
|
|
if (Failed(State::CreateFromFile("engine_state.xml", mState)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::WARNING, "Unable to load state file: engine_state.xml. Loading default state.");
|
|
|
|
Logger::Warn(LogCategory::CORE, "Unable to load state file: engine_state.xml. Loading default state.");
|
|
|
|
mState = State::CreateDefault();
|
|
|
|
mState = State::CreateDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Loaded state file: engine_state.xml");
|
|
|
|
Logger::Info(LogCategory::CORE, "Loaded state file: engine_state.xml");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Parse command line args -- None right now
|
|
|
|
// Parse command line args -- None right now
|
|
|
|
@ -160,7 +164,7 @@ namespace lunarium
|
|
|
|
result = mpWindow->Initialize(mState);
|
|
|
|
result = mpWindow->Initialize(mState);
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
|
|
|
|
Logger::Fatal(LogCategory::CORE,
|
|
|
|
"Could not initialize the Window system: %s", result.Description.c_str());
|
|
|
|
"Could not initialize the Window system: %s", result.Description.c_str());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -171,13 +175,13 @@ namespace lunarium
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (RenderSystem::VULKAN == mState.Display.Renderer)
|
|
|
|
else if (RenderSystem::VULKAN == mState.Display.Renderer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
|
|
|
|
Logger::Fatal(LogCategory::CORE,
|
|
|
|
"Can not create Vulkan graphics system because it is not yet implemented. Must use OpenGL instead.");
|
|
|
|
"Can not create Vulkan graphics system because it is not yet implemented. Must use OpenGL instead.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
|
|
|
|
Logger::Fatal(LogCategory::CORE,
|
|
|
|
"Could not create graphics system: Unknown render framework specified.");
|
|
|
|
"Could not create graphics system: Unknown render framework specified.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -191,7 +195,7 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
|
|
|
|
Logger::Fatal(LogCategory::CORE,
|
|
|
|
"Could not initialized the graphics system: %s", result.Description);
|
|
|
|
"Could not initialized the graphics system: %s", result.Description);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -206,7 +210,7 @@ namespace lunarium
|
|
|
|
result = mGUI.Initialize(mpWindow->GetWindow());
|
|
|
|
result = mGUI.Initialize(mpWindow->GetWindow());
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::WARNING,
|
|
|
|
Logger::Warn(LogCategory::CORE,
|
|
|
|
"Could not initialized the main GUI system: %s", result.Description);
|
|
|
|
"Could not initialized the main GUI system: %s", result.Description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -215,7 +219,7 @@ namespace lunarium
|
|
|
|
result = scriptMan.Initialize();
|
|
|
|
result = scriptMan.Initialize();
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::WARNING,
|
|
|
|
Logger::Warn(LogCategory::CORE,
|
|
|
|
"Could not initialized the LUA script manager: %s", result.Description);
|
|
|
|
"Could not initialized the LUA script manager: %s", result.Description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -223,13 +227,13 @@ namespace lunarium
|
|
|
|
result = capi.Initialize(scriptMan);
|
|
|
|
result = capi.Initialize(scriptMan);
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::WARNING,
|
|
|
|
Logger::Warn(LogCategory::CORE,
|
|
|
|
"Could not initialized the LUA Core API: %s", result.Description);
|
|
|
|
"Could not initialized the LUA Core API: %s", result.Description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RUN MODE
|
|
|
|
// RUN MODE
|
|
|
|
const char* types[] = { "game", "editor", "test" };
|
|
|
|
const char* types[] = { "game", "editor", "test" };
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running in mode: %s", types[mState.Mode]);
|
|
|
|
Logger::Info(LogCategory::CORE, "Running in mode: %s", types[mState.Mode]);
|
|
|
|
if (RunMode::MODE_TEST == mState.Mode)
|
|
|
|
if (RunMode::MODE_TEST == mState.Mode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mpRunMode = new TestBed;
|
|
|
|
mpRunMode = new TestBed;
|
|
|
|
@ -238,7 +242,7 @@ namespace lunarium
|
|
|
|
else if (RunMode::MODE_EDITOR == mState.Mode)
|
|
|
|
else if (RunMode::MODE_EDITOR == mState.Mode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#if BUILD_NO_EDITOR
|
|
|
|
#if BUILD_NO_EDITOR
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR, "The Editor is not available with this build");
|
|
|
|
Logger::Fatal(LogCategory::CORE, "The Editor is not available with this build");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
mpRunMode = new editor::Editor;
|
|
|
|
mpRunMode = new editor::Editor;
|
|
|
|
@ -249,7 +253,7 @@ namespace lunarium
|
|
|
|
// Initialize the Run Mode
|
|
|
|
// Initialize the Run Mode
|
|
|
|
if (Failed(mpRunMode->Initialize()))
|
|
|
|
if (Failed(mpRunMode->Initialize()))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
|
|
|
|
Logger::Fatal(LogCategory::CORE,
|
|
|
|
"Could not initialize the Run Mode: %s", result.Description.c_str());
|
|
|
|
"Could not initialize the Run Mode: %s", result.Description.c_str());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -314,11 +318,11 @@ namespace lunarium
|
|
|
|
std::string command;
|
|
|
|
std::string command;
|
|
|
|
if (con && con->GetNewCommand(command))
|
|
|
|
if (con && con->GetNewCommand(command))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Logger::Log(LogCategory::CORE, LogLevel::INFO, "New LUA command: %s", command.c_str());
|
|
|
|
// Logger::Debug(LogCategory::SCRIPTING, "New LUA command: %s", command.c_str());
|
|
|
|
OpRes result = ScriptManager::RunScript(command.c_str());
|
|
|
|
OpRes result = ScriptManager::RunScript(command.c_str());
|
|
|
|
if (Failed(result))
|
|
|
|
if (Failed(result))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::INFO_VERBOSE, result.Description.c_str());
|
|
|
|
Logger::Error(LogCategory::SCRIPTING, result.Description.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -342,7 +346,7 @@ namespace lunarium
|
|
|
|
// RENDER
|
|
|
|
// RENDER
|
|
|
|
if (mbMidTextureRender)
|
|
|
|
if (mbMidTextureRender)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger::Log(LogCategory::CORE, LogLevel::WARNING, "Render to texture was not ended!");
|
|
|
|
Logger::Warn(LogCategory::CORE, "Render to texture was not ended!");
|
|
|
|
EndRenderToTexture();
|
|
|
|
EndRenderToTexture();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|