mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-15 04:29:37 +00:00
Refactoring, clean up shutdown path
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
#include "GpAppEnvironment.h"
|
||||
#include "GpFiberStarter.h"
|
||||
#include "GpAppInterface.h"
|
||||
#include "GpDisplayDriverTickStatus.h"
|
||||
#include "GpFontHandlerFactory.h"
|
||||
#include "GpPLGlueAudioDriver.h"
|
||||
#include "GpPLGlueDisplayDriver.h"
|
||||
#include "HostSuspendCallArgument.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpFiber.h"
|
||||
#include "IGpInputDriver.h"
|
||||
|
||||
@@ -35,7 +37,7 @@ void GpAppEnvironment::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void GpAppEnvironment::Tick(IGpFiber *vosFiber)
|
||||
GpDisplayDriverTickStatus_t GpAppEnvironment::Tick(IGpFiber *vosFiber)
|
||||
{
|
||||
GpAppInterface_Get()->PL_IncrementTickCounter(1);
|
||||
|
||||
@@ -54,7 +56,7 @@ void GpAppEnvironment::Tick(IGpFiber *vosFiber)
|
||||
m_applicationState = ApplicationState_Running;
|
||||
break;
|
||||
case ApplicationState_WaitingForEvents:
|
||||
return;
|
||||
return GpDisplayDriverTickStatuses::kOK;
|
||||
case ApplicationState_Running:
|
||||
SynchronizeState();
|
||||
m_applicationFiber->YieldTo();
|
||||
@@ -75,9 +77,13 @@ void GpAppEnvironment::Tick(IGpFiber *vosFiber)
|
||||
else
|
||||
{
|
||||
m_delaySuspendTicks--;
|
||||
return;
|
||||
return GpDisplayDriverTickStatuses::kOK;
|
||||
}
|
||||
break;
|
||||
case ApplicationState_Terminated:
|
||||
m_applicationFiber->Destroy();
|
||||
m_applicationFiber = nullptr;
|
||||
return GpDisplayDriverTickStatuses::kApplicationTerminated;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
@@ -124,6 +130,9 @@ void GpAppEnvironment::StaticAppThreadFunc(void *context)
|
||||
void GpAppEnvironment::AppThreadFunc()
|
||||
{
|
||||
GpAppInterface_Get()->ApplicationMain();
|
||||
|
||||
m_applicationState = ApplicationState_Terminated;
|
||||
m_vosFiber->YieldTo();
|
||||
}
|
||||
|
||||
void GpAppEnvironment::InitializeApplicationState()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "GpDisplayDriverTickStatus.h"
|
||||
#include "GpVOSEventQueue.h"
|
||||
#include "HostSuspendCallID.h"
|
||||
|
||||
@@ -25,7 +26,7 @@ public:
|
||||
|
||||
void Init();
|
||||
|
||||
void Tick(IGpFiber *vosFiber);
|
||||
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
||||
void Render();
|
||||
|
||||
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\GpCommon\EGpInputDriverType.h" />
|
||||
<ClInclude Include="..\GpCommon\EGpStandardCursor.h" />
|
||||
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h" />
|
||||
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
|
||||
<ClInclude Include="..\GpCommon\IGpColorCursor.h" />
|
||||
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
|
||||
|
||||
@@ -191,6 +191,9 @@
|
||||
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="GpD3D.rc">
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "GpFontHandlerFactory.h"
|
||||
#include "GpDisplayDriverFactory.h"
|
||||
#include "GpDisplayDriverProperties.h"
|
||||
#include "GpDisplayDriverTickStatus.h"
|
||||
#include "GpInputDriverFactory.h"
|
||||
#include "GpInputDriverProperties.h"
|
||||
#include "GpGlobalConfig.h"
|
||||
@@ -17,9 +18,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
void TickAppEnvironment(void *context, IGpFiber *vosFiber)
|
||||
GpDisplayDriverTickStatus_t TickAppEnvironment(void *context, IGpFiber *vosFiber)
|
||||
{
|
||||
static_cast<GpAppEnvironment*>(context)->Tick(vosFiber);
|
||||
return static_cast<GpAppEnvironment*>(context)->Tick(vosFiber);
|
||||
}
|
||||
|
||||
void RenderAppEnvironment(void *context)
|
||||
|
||||
Reference in New Issue
Block a user