SHADE_Y3/SHADE_Application/src/WinMain.cpp

51 lines
1.2 KiB
C++

#include "SBpch.h"
#include <Engine/SHEngine.h>
#include <Tools/Logger/SHLogger.h>
#include <Tools/SHExceptionHandler.h>
#include "Application/SBApplication.h"
#define _CRTDBG_MAP_ALLOC
#include <cstdlib>
#include <crtdbg.h>
#ifdef _DEBUG
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
// Replace _NORMAL_BLOCK with _CLIENT_BLOCK if you want the
// allocations to be of _CLIENT_BLOCK type
#else
#define DBG_NEW new
#endif
INT WINAPI wWinMain
(
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ INT nCmdShow
)
{
const SHADE::SHLogger::Config LOGGER_CONFIG{ .directoryPath = "./logs/" };
auto logger = SHADE::SHLogger::Initialise(LOGGER_CONFIG);
try
{
#ifndef SHEDITOR
//ShowWindow(::GetConsoleWindow(), SW_HIDE);
#endif
SHLOG_REGISTER(logger)
SHADE::SHEngine::Run<Sandbox::SBApplication>(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
}
catch(...)
{
SHADE::SHExceptionHandler::HandleException(std::current_exception());
SHADE::SHLogger::Shutdown();
}
SHADE::SHLogger::Shutdown();
return 0;
}