This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_winrtrenderer.h
54 lines (44 loc) · 1.6 KB
1
2
#pragma once
3
4
#include "DirectXHelper.h"
#include "SDL.h"
5
#include "../../render/direct3d11/SDL_render_d3d11_cpp.h"
6
7
8
struct VertexPositionColor
{
9
10
DirectX::XMFLOAT3 pos;
DirectX::XMFLOAT2 tex;
11
12
};
13
14
// Helper class that initializes DirectX APIs for 3D rendering.
ref class SDL_winrtrenderer
15
{
16
internal:
17
SDL_winrtrenderer();
18
19
public:
20
virtual ~SDL_winrtrenderer();
21
22
23
24
25
26
27
virtual void Initialize(Windows::UI::Core::CoreWindow^ window);
virtual void HandleDeviceLost();
virtual void CreateDeviceResources();
virtual void CreateWindowSizeDependentResources();
virtual void UpdateForWindowSizeChange();
virtual void Present();
virtual float ConvertDipsToPixels(float dips);
28
29
internal:
30
virtual void Render(SDL_Surface * surface, SDL_Rect * rects, int numrects);
31
void ResizeMainTexture(int w, int h);
32
33
34
35
internal:
// Internal SDL rendeerer (likely a temporary addition, for refactoring purposes):
D3D11_RenderData * m_sdlRendererData;
36
37
protected private:
38
39
40
// UpdateWindowSurface helper objects
SDL_Surface * m_mainTextureHelperSurface;
41
42
43
44
45
46
47
// Cached renderer properties.
D3D_FEATURE_LEVEL m_featureLevel;
Windows::Foundation::Size m_renderTargetSize;
Windows::Foundation::Rect m_windowBounds;
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
Windows::Graphics::Display::DisplayOrientations m_orientation;
uint32 m_vertexCount;
48
49
50
// Transform used for display orientation.
DirectX::XMFLOAT4X4 m_orientationTransform3D;
51
52
53
// Has the renderer finished loading?
bool m_loadingComplete;
54
};