Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UWP/PPSSPP_UWPMain.h
3185 views
1
#pragma once
2
3
#include <mutex>
4
5
#include "Common/GPU/thin3d.h"
6
#include "Common/Input/InputState.h"
7
8
#include "Common/GraphicsContext.h"
9
#include "Common/DeviceResources.h"
10
#include "Windows/InputDevice.h"
11
12
// Renders Direct2D and 3D content on the screen.
13
namespace UWP {
14
15
ref class App;
16
enum class HardwareButton;
17
18
class UWPGraphicsContext : public GraphicsContext {
19
public:
20
UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources);
21
22
void Shutdown() override;
23
void Resize() override {}
24
Draw::DrawContext * GetDrawContext() override {
25
return draw_;
26
}
27
28
private:
29
Draw::DrawContext *draw_;
30
std::shared_ptr<DX::DeviceResources> resources_;
31
};
32
33
class PPSSPP_UWPMain : public DX::IDeviceNotify {
34
public:
35
PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResources>& deviceResources);
36
~PPSSPP_UWPMain();
37
void CreateWindowSizeDependentResources();
38
void UpdateScreenState();
39
bool Render();
40
41
// IDeviceNotify
42
virtual void OnDeviceLost();
43
virtual void OnDeviceRestored();
44
45
// Various forwards from App, in simplified format.
46
// Not sure whether this abstraction is worth it.
47
void OnKeyDown(int scanCode, Windows::System::VirtualKey virtualKey, int repeatCount);
48
void OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKey);
49
void OnCharacterReceived(int scanCode,unsigned int keyCode);
50
51
void OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp);
52
53
void OnMouseWheel(float delta);
54
55
bool OnHardwareButton(HardwareButton button);
56
57
void RotateXYToDisplay(float &x, float &y);
58
59
// Save state fast if we can!
60
void OnSuspend();
61
void Close();
62
63
private:
64
App ^app_;
65
66
// Cached pointer to device resources.
67
std::shared_ptr<DX::DeviceResources> m_deviceResources;
68
69
std::unique_ptr<UWPGraphicsContext> ctx_;
70
};
71
72
}
73
74