-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindow.cpp
More file actions
61 lines (52 loc) · 1 KB
/
window.cpp
File metadata and controls
61 lines (52 loc) · 1 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
#include "window.h"
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
Window::Window(HINSTANCE hInstance)
{
const auto winClassName = "SimpleExampleWindowClass";
WNDCLASSEX wc = { };
wc.cbSize = sizeof(wc);
wc.style = CS_OWNDC;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = nullptr;
wc.hCursor = nullptr;
wc.hbrBackground = nullptr;
wc.lpszMenuName = nullptr;
wc.lpszClassName = winClassName;
wc.hIconSm = nullptr;
RegisterClassEx(&wc);
hwnd_ = CreateWindowEx(
0,
winClassName,
"MyWindow",
WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,
200,
200,
1024,
768,
nullptr,
nullptr,
hInstance,
nullptr
);
graphics_ = new Graphics();
ShowWindow(hwnd_, SW_SHOW);
}
Window::~Window()
{
delete graphics_;
}
bool Window::InitGraphics()
{
return graphics_->Init(hwnd_);
}
void Window::Render()
{
graphics_->BeginFrame();
graphics_->EndFrame();
}