2017-02-24 19:50:27 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
#include <mutex>
|
|
|
|
|
|
2020-10-04 21:24:14 +00:00
|
|
|
|
#include "Common/GPU/thin3d.h"
|
2020-10-01 07:36:43 +00:00
|
|
|
|
#include "Common/Input/InputState.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
#include "Common/GraphicsContext.h"
|
|
|
|
|
#include "Common/DeviceResources.h"
|
|
|
|
|
|
|
|
|
|
// Renders Direct2D and 3D content on the screen.
|
|
|
|
|
namespace UWP {
|
2017-02-27 10:32:40 +00:00
|
|
|
|
|
|
|
|
|
ref class App;
|
2017-03-07 09:33:53 +00:00
|
|
|
|
enum class HardwareButton;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
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 09:28:57 +00:00
|
|
|
|
return draw_;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2017-02-27 09:28:57 +00:00
|
|
|
|
Draw::DrawContext *draw_;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
std::shared_ptr<DX::DeviceResources> resources_;
|
|
|
|
|
};
|
|
|
|
|
|
2017-03-05 00:39:26 +00:00
|
|
|
|
class PPSSPP_UWPMain : public DX::IDeviceNotify {
|
2017-02-24 19:50:27 +00:00
|
|
|
|
public:
|
2017-02-27 10:32:40 +00:00
|
|
|
|
PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResources>& deviceResources);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
~PPSSPP_UWPMain();
|
|
|
|
|
void CreateWindowSizeDependentResources();
|
|
|
|
|
bool Render();
|
|
|
|
|
|
|
|
|
|
// IDeviceNotify
|
|
|
|
|
virtual void OnDeviceLost();
|
|
|
|
|
virtual void OnDeviceRestored();
|
|
|
|
|
|
2017-02-27 10:00:57 +00: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-27 10:32:40 +00:00
|
|
|
|
void OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp);
|
|
|
|
|
|
2017-03-01 22:40:52 +00:00
|
|
|
|
void OnMouseWheel(float delta);
|
|
|
|
|
|
2017-03-07 09:33:53 +00:00
|
|
|
|
bool OnHardwareButton(HardwareButton button);
|
2017-03-05 00:39:26 +00:00
|
|
|
|
|
|
|
|
|
void RotateXYToDisplay(float &x, float &y);
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
// Save state fast if we can!
|
|
|
|
|
void OnSuspend();
|
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
|
|
void LoadStorageFile(Windows::Storage::StorageFile ^file);
|
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
private:
|
2017-02-27 10:32:40 +00:00
|
|
|
|
App ^app_;
|
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
// Cached pointer to device resources.
|
|
|
|
|
std::shared_ptr<DX::DeviceResources> m_deviceResources;
|
|
|
|
|
|
2017-02-27 09:28:57 +00:00
|
|
|
|
std::unique_ptr<UWPGraphicsContext> ctx_;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|