2017-02-24 20:50:27 +01:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "thin3d/thin3d.h"
|
|
|
|
|
|
|
|
|
|
#include "Common/GraphicsContext.h"
|
|
|
|
|
#include "Common/DeviceResources.h"
|
|
|
|
|
|
|
|
|
|
// Renders Direct2D and 3D content on the screen.
|
|
|
|
|
namespace UWP {
|
|
|
|
|
|
|
|
|
|
class UWPGraphicsContext : public GraphicsContext {
|
|
|
|
|
public:
|
|
|
|
|
UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources);
|
|
|
|
|
|
|
|
|
|
void Shutdown() override;
|
|
|
|
|
void SwapInterval(int interval) override;
|
|
|
|
|
void SwapBuffers() override {}
|
|
|
|
|
void Resize() override {}
|
|
|
|
|
Draw::DrawContext * GetDrawContext() override {
|
2017-02-27 10:28:57 +01:00
|
|
|
|
return draw_;
|
2017-02-24 20:50:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2017-02-27 10:28:57 +01:00
|
|
|
|
Draw::DrawContext *draw_;
|
2017-02-24 20:50:27 +01:00
|
|
|
|
std::shared_ptr<DX::DeviceResources> resources_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PPSSPP_UWPMain : public DX::IDeviceNotify
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
PPSSPP_UWPMain(const std::shared_ptr<DX::DeviceResources>& deviceResources);
|
|
|
|
|
~PPSSPP_UWPMain();
|
|
|
|
|
void CreateWindowSizeDependentResources();
|
|
|
|
|
bool Render();
|
|
|
|
|
|
|
|
|
|
// IDeviceNotify
|
|
|
|
|
virtual void OnDeviceLost();
|
|
|
|
|
virtual void OnDeviceRestored();
|
|
|
|
|
|
2017-02-27 11:00:57 +01:00
|
|
|
|
// Various forwards from App, in simplified format.
|
|
|
|
|
// Not sure whether this abstraction is worth it.
|
|
|
|
|
void OnKeyDown(int scanCode, Windows::System::VirtualKey virtualKey, int repeatCount);
|
|
|
|
|
void OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKey);
|
|
|
|
|
|
2017-02-24 20:50:27 +01:00
|
|
|
|
private:
|
|
|
|
|
// Cached pointer to device resources.
|
|
|
|
|
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
|
|
|
|
|
2017-02-27 10:28:57 +01:00
|
|
|
|
std::unique_ptr<UWPGraphicsContext> ctx_;
|
2017-02-24 20:50:27 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|