-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDevice.h
More file actions
63 lines (42 loc) · 1.16 KB
/
Device.h
File metadata and controls
63 lines (42 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class Device
{
D3D_DRIVER_TYPE m_driverType;
D3D_FEATURE_LEVEL m_featureLevel;
ID3D11Device* g_pd3dDevice;
ID3D11DeviceContext* g_pImmediateContext;
//ID3D11Texture2D* m_pBackBuffer;
IDXGISwapChain* g_pSwapChain;
ID3D11RenderTargetView* g_pRenderTargetView;
D3D11_VIEWPORT g_vp;
UINT m_width, m_height;
public:
DXGI_FORMAT m_format;
Device() : m_driverType(D3D_DRIVER_TYPE_NULL), m_featureLevel(D3D_FEATURE_LEVEL_11_0),
g_pd3dDevice(NULL), g_pImmediateContext(NULL), g_pSwapChain(NULL), g_pRenderTargetView(NULL)
//m_pBackBuffer(NULL)
{
//create all objects
}
~Device()
{
ClearDevice();
}
ID3D11Device* GetDevice() {
return g_pd3dDevice;
}
ID3D11DeviceContext* GetContext(){
return g_pImmediateContext;
}
void Present(){
if (m_width > 0 && m_height > 0){
//g_pSwapChain->Present(1, 0); //run at monitor rate
g_pSwapChain->Present(0, 0); //run at highest possible rate,
//we have to wait for the ALazar input anyway
}
else
Sleep(500); //window has been minimized
}
HRESULT InitDevice(HWND hwnd);
void ClearDevice();
HRESULT Resize(HWND hwnd);
};