2019-12-11 00:51:42 -05:00
|
|
|
#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"
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2020-11-25 12:05:59 -05:00
|
|
|
#include "PLDrivers.h"
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
int gpAppMain();
|
2020-10-20 23:43:02 -04:00
|
|
|
void gpAppInit();
|
2019-12-11 00:51:42 -05:00
|
|
|
|
2020-11-25 12:05:59 -05:00
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
class GpAppInterfaceImpl final : public GpAppInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
2020-10-20 23:43:02 -04:00
|
|
|
void ApplicationInit() override;
|
2019-12-11 00:51:42 -05:00
|
|
|
int ApplicationMain() override;
|
2020-10-20 23:43:02 -04:00
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
void PL_IncrementTickCounter(uint32_t count) override;
|
2019-12-21 18:40:17 -05:00
|
|
|
void PL_Render(IGpDisplayDriver *displayDriver) override;
|
2020-11-25 12:05:59 -05:00
|
|
|
GpDriverCollection *PL_GetDriverCollection() override;
|
2019-12-11 00:51:42 -05:00
|
|
|
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
2020-04-18 00:18:20 -04:00
|
|
|
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
|
2019-12-11 00:51:42 -05:00
|
|
|
};
|
|
|
|
|
|
2020-10-20 23:43:02 -04:00
|
|
|
void GpAppInterfaceImpl::ApplicationInit()
|
|
|
|
|
{
|
|
|
|
|
gpAppInit();
|
|
|
|
|
}
|
2019-12-11 00:51:42 -05:00
|
|
|
|
|
|
|
|
int GpAppInterfaceImpl::ApplicationMain()
|
|
|
|
|
{
|
|
|
|
|
return 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
|
|
|
}
|
|
|
|
|
|
2020-11-25 12:05:59 -05:00
|
|
|
GpDriverCollection *GpAppInterfaceImpl::PL_GetDriverCollection()
|
2019-12-21 18:40:17 -05:00
|
|
|
{
|
2020-11-25 12:05:59 -05:00
|
|
|
return PLDrivers::GetDriverCollection();
|
2019-12-21 18:40:17 -05:00
|
|
|
}
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context)
|
|
|
|
|
{
|
|
|
|
|
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-18 00:18:20 -04:00
|
|
|
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
|
2020-04-04 02:20:03 -04:00
|
|
|
{
|
2020-04-06 03:34:31 -04:00
|
|
|
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
|
|
|
|
|
|
|
|
|
|
if (!handler)
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-04-18 00:18:20 -04:00
|
|
|
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
|
2020-04-06 03:34:31 -04:00
|
|
|
|
|
|
|
|
return true;
|
2020-04-04 02:20:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-12-11 00:51:42 -05:00
|
|
|
static GpAppInterfaceImpl gs_application;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get()
|
|
|
|
|
{
|
|
|
|
|
return &gs_application;
|
|
|
|
|
}
|