mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
#include "GpAppInterface.h"
|
|
|
|
#include "DisplayDeviceManager.h"
|
|
#include "MenuManager.h"
|
|
#include "WindowManager.h"
|
|
|
|
#include "PLDrivers.h"
|
|
#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;
|
|
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()
|
|
{
|
|
return PLSysCalls::MainExitWrapper(gpAppMain);
|
|
}
|
|
|
|
void GpAppInterfaceImpl::PL_IncrementTickCounter(uint32_t count)
|
|
{
|
|
PortabilityLayer::DisplayDeviceManager::GetInstance()->IncrementTickCount(count);
|
|
}
|
|
|
|
void GpAppInterfaceImpl::PL_Render(IGpDisplayDriver *displayDriver)
|
|
{
|
|
PortabilityLayer::WindowManager::GetInstance()->RenderFrame(displayDriver);
|
|
PortabilityLayer::MenuManager::GetInstance()->RenderFrame(displayDriver);
|
|
}
|
|
|
|
GpDriverCollection *GpAppInterfaceImpl::PL_GetDriverCollection()
|
|
{
|
|
return PLDrivers::GetDriverCollection();
|
|
}
|
|
|
|
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)
|
|
{
|
|
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
|
|
|
|
if (!handler)
|
|
return false;
|
|
|
|
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
static GpAppInterfaceImpl gs_application;
|
|
|
|
|
|
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get()
|
|
{
|
|
return &gs_application;
|
|
}
|