Files
Aerofoil/GpApp/GpAppInterface.cpp

78 lines
2.2 KiB
C++
Raw Normal View History

#include "GpAppInterface.h"
#include "DisplayDeviceManager.h"
2019-12-24 02:35:24 -05:00
#include "MenuManager.h"
2019-12-21 18:40:17 -05:00
#include "WindowManager.h"
#include "PLDrivers.h"
2020-11-30 03:18:09 -05:00
#include "PLSysCalls.h"
int gpAppMain();
void gpAppInit();
class GpAppInterfaceImpl final : public GpAppInterface
{
public:
void ApplicationInit() override;
int ApplicationMain() override;
void PL_IncrementTickCounter(uint32_t count) override;
2019-12-21 18:40:17 -05:00
void PL_Render(IGpDisplayDriver *displayDriver) override;
GpDriverCollection *PL_GetDriverCollection() override;
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
};
void GpAppInterfaceImpl::ApplicationInit()
{
gpAppInit();
}
int GpAppInterfaceImpl::ApplicationMain()
{
2020-11-30 03:18:09 -05:00
return PLSysCalls::MainExitWrapper(gpAppMain);
}
void GpAppInterfaceImpl::PL_IncrementTickCounter(uint32_t count)
{
PortabilityLayer::DisplayDeviceManager::GetInstance()->IncrementTickCount(count);
}
2019-12-21 18:40:17 -05:00
void GpAppInterfaceImpl::PL_Render(IGpDisplayDriver *displayDriver)
{
PortabilityLayer::WindowManager::GetInstance()->RenderFrame(displayDriver);
2019-12-24 02:35:24 -05:00
PortabilityLayer::MenuManager::GetInstance()->RenderFrame(displayDriver);
2019-12-21 18:40:17 -05:00
}
GpDriverCollection *GpAppInterfaceImpl::PL_GetDriverCollection()
2019-12-21 18:40:17 -05:00
{
return PLDrivers::GetDriverCollection();
2019-12-21 18:40:17 -05:00
}
void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context)
{
PortabilityLayer::InstallHostSuspendHook(hook, context);
}
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
2020-04-06 03:34:31 -04:00
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
if (!handler)
return false;
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
2020-04-06 03:34:31 -04:00
return true;
}
static GpAppInterfaceImpl gs_application;
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get()
{
return &gs_application;
}