-
Notifications
You must be signed in to change notification settings - Fork 0
/
window_renderer.h
58 lines (41 loc) · 1.1 KB
/
window_renderer.h
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
//
// Created by disc on 1/17/2021.
//
#ifndef CAM_CLI_WINDOW_RENDERER_H
#define CAM_CLI_WINDOW_RENDERER_H
#include <wrl/client.h>
#include <cstdint>
class IDCompositionDevice;
class IDCompositionVisual;
class IDCompositionTarget;
class IDXGIDevice;
class IDXGISwapChain1;
using Microsoft::WRL::ComPtr;
/**
* Create a win32 window bound to a an IDXGISwapChain.
* It can be used to the |bitmap_sink| class to render
* samples written to it.
*/
class window_renderer {
public:
struct settings {
uint32_t width;
uint32_t height;
};
window_renderer(settings s);
~window_renderer();
void run();
void close();
void bind_render_target(IDXGISwapChain1 *swap_chain);
private:
static LRESULT CALLBACK window_proc(HWND hwnd, uint32_t message,
WPARAM wparm, LPARAM lparam);
void create_window();
// Composition
ComPtr<IDCompositionDevice> dcomp_device_;
ComPtr<IDCompositionVisual> visual_;
ComPtr<IDCompositionTarget> target_;
HWND hwnd_;
settings settings_;
};
#endif//CAM_CLI_WINDOW_RENDERER_H