-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinClass.h
More file actions
79 lines (59 loc) · 1.63 KB
/
WinClass.h
File metadata and controls
79 lines (59 loc) · 1.63 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*!
\file WinClass.h
\author Darrell Lek (100%)
\par email: d.lek@digipen.edu
\date September 27, 2022
\brief Function declaration of WinClass class
Copyright (C) 2022 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents without the
prior written consent of DigiPen Institute of Technology is prohibited.
*/
/******************************************************************************/
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
class Win32GLWindow
{
public:
Win32GLWindow();
~Win32GLWindow();
bool Create(const char* title, int width, int height, bool fullscreen);
void Destroy();
void Show();
void Hide();
void SetTitle(const char* title);
void SetSize(int width, int height);
void SetFullscreen(bool fullscreen);
void SetCursorVisible(bool visible);
void SetCursorLocked(bool locked);
void SetVSync(bool vsync);
void SwapBuffers()
{
::SwapBuffers(m_hDC);
}
bool IsFullscreen() const;
bool IsCursorVisible() const;
bool IsCursorLocked() const;
bool IsVSync() const;
int GetWidth() const;
int GetHeight() const;
HWND GetHandle() const
{
return m_hWnd;
}
bool ProcessMessages();
void ResizeCallback(int width, int height);
private:
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
HWND m_hWnd;
HDC m_hDC;
HGLRC m_hRC;
RECT m_windowedRect; // used to store the windowed rect when switching to fullscreen
bool m_isFullscreen;
bool m_isCursorVisible;
bool m_isCursorLocked;
bool m_isVSync;
int m_width;
int m_height;
};