110 lines
3.2 KiB
C++
110 lines
3.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AronaApp.h"
|
|
|
|
#include "App.h"
|
|
#include "AronaMain.h"
|
|
#include "ConfigCacheIni.h"
|
|
#include "OutputDeviceRedirector.h"
|
|
#include "QueuedThreadPool.h"
|
|
#include "QueuedThreadPoolWrapper.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Framework/Docking/TabManager.h"
|
|
#include "Framework/Docking/WorkspaceItem.h"
|
|
#include "StandaloneRenderer.h"
|
|
#include "StdOutputDevice.h"
|
|
#include "Singleton/SingletonManager.h"
|
|
#include "Stats2.h"
|
|
#include "Test.h"
|
|
#include "Singleton/CallRateLimiterManager.h"
|
|
#include "Thread/MainThreadEventList.h"
|
|
#include "UI/Widget/WindowManager.h"
|
|
|
|
IMPLEMENT_APPLICATION(Arona, "Arona");
|
|
|
|
#define LOCTEXT_NAMESPACE "Arona"
|
|
|
|
int32 Init(const TCHAR* CmdLine)
|
|
{
|
|
FCommandLine::Set(CmdLine);
|
|
// FGenericPlatformProcess::SetShaderDir(*FPaths::Combine(FPaths::ProjectContentDir(), TEXT("Shader")));
|
|
FGenericPlatformProcess::SetShaderDir(TEXT("E:\\Projects\\AronaSlate\\Content\\Shader"));
|
|
GThreadPool = new FQueuedLowLevelThreadPool();
|
|
InitLog();
|
|
// BUG: Memoty leak
|
|
// #if STATS
|
|
// FThreadStats::StartThread();
|
|
// #endif
|
|
FPlatformMisc::PlatformPreInit();
|
|
FConfigCacheIni::InitializeConfigSystem();
|
|
FPlatformMisc::PlatformInit();
|
|
FPlatformMisc::SetGracefulTerminationHandler();
|
|
|
|
{
|
|
FTaskTagScope Scope(ETaskTag::EGameThread);
|
|
FTaskGraphInterface::Startup(FPlatformMisc::NumberOfWorkerThreadsToSpawn());
|
|
FTaskGraphInterface::Get().AttachToThread(ENamedThreads::GameThread);
|
|
|
|
FDelayedAutoRegisterHelper::RunAndClearDelayedAutoRegisterDelegates(EDelayedRegisterRunPhase::TaskGraphSystemReady);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
int RunArona( const TCHAR* CommandLine )
|
|
{
|
|
Init(CommandLine);
|
|
|
|
// crank up a normal Slate application using the platform's standalone renderer
|
|
FSlateApplication::InitializeAsStandaloneApplication(GetStandardStandaloneRenderer());
|
|
FSlateApplication::InitHighDPI(true);
|
|
|
|
FSingletonManager::GetInstance().Init();
|
|
|
|
FMainThreadEventList& MainThreadEventList = FMainThreadEventList::Get();
|
|
FWindowManager& WindowManager = FWindowManager::Get();
|
|
FCallRateLimiterManager& RateLimiterManager = FCallRateLimiterManager::Get();
|
|
|
|
AronaTest();
|
|
|
|
constexpr float FrameRate = 1.f / 360.0f;
|
|
FSlateApplication& SlateApplication = FSlateApplication::Get();
|
|
FTaskGraphInterface& TaskGraphInterface = FTaskGraphInterface::Get();
|
|
FTSTicker& CoreTicker = FTSTicker::GetCoreTicker();
|
|
|
|
// loop while the server does the rest
|
|
while (!IsEngineExitRequested())
|
|
{
|
|
BeginExitIfRequested();
|
|
|
|
TaskGraphInterface.ProcessThreadUntilIdle(ENamedThreads::GameThread);
|
|
CoreTicker.Tick(FApp::GetDeltaTime());
|
|
SlateApplication.PumpMessages();
|
|
MainThreadEventList.ProcessMessage();
|
|
|
|
SlateApplication.Tick();
|
|
FPlatformProcess::SleepNoStats(FrameRate);
|
|
RateLimiterManager.Update(FApp::GetDeltaTime());
|
|
|
|
GFrameCounter++;
|
|
}
|
|
|
|
|
|
|
|
FSingletonManager::GetInstance().Release();
|
|
FCoreDelegates::OnExit.Broadcast();
|
|
FSlateApplication::Shutdown();
|
|
FModuleManager::Get().UnloadModulesAtShutdown();
|
|
FTaskGraphInterface::Shutdown();
|
|
FPlatformMisc::PlatformTearDown();
|
|
delete GThreadPool;
|
|
// BUG: Memoty leak
|
|
// #if STATS
|
|
// FThreadStats::StopThread();
|
|
// #endif
|
|
TearDownLog();
|
|
return 0;
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|