-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXWindow.h
50 lines (40 loc) · 1.15 KB
/
XWindow.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
#pragma once
#include <windows.h>
#include "HelperFunctions.h"
#include "resource.h"
#include "XD3D.h"
#define MAX_LOADSTRING 100
class XWindow
{
protected:
HINSTANCE m_hInst;
WCHAR m_szTitle[MAX_LOADSTRING];
WCHAR m_szWindowClass[MAX_LOADSTRING];
HWND m_hWnd;
int m_height, m_width;
public:
XWindow() {}
XWindow(WCHAR* title, int width, int height);
~XWindow() {}
HWND GetWindowHandle() { return m_hWnd; }
WCHAR* GetWindowTitle() { return m_szTitle; }
WCHAR* GetWindowClass() { return m_szWindowClass; }
void SetWindowWidth(int w) {
m_width = w;
}
void SetWindowHeight(int h) {
m_height = h;
}
void SetTitle(WCHAR* title) {
memcpy(m_szTitle, title, sizeof(title));
}
void FAIL_MSG_BOX(const std::string& msg) const
{
std::wstring wideString = std::wstring(msg.begin(), msg.end());
LPCWSTR wmsg = wideString.c_str();
MessageBox(m_hWnd, wmsg, L"Error", MB_OK);
}
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
virtual ATOM MyRegisterClass(HINSTANCE hInstance);
virtual int InitInstance(HINSTANCE, int);
};