diff options
Diffstat (limited to 'dxwindow/include')
| -rw-r--r-- | dxwindow/include/dxwindow.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dxwindow/include/dxwindow.h b/dxwindow/include/dxwindow.h new file mode 100644 index 0000000..e8f551a --- /dev/null +++ b/dxwindow/include/dxwindow.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | // Include Windows.h before GLFW to avoid macro redefinition warnings. | ||
| 4 | #define WIN32_LEAN_AND_MEAN | ||
| 5 | #include <Windows.h> | ||
| 6 | |||
| 7 | #define GLFW_INCLUDE_NONE // Do not include OpenGL headers. | ||
| 8 | #include <GLFW/glfw3.h> | ||
| 9 | |||
| 10 | namespace dx | ||
| 11 | { | ||
| 12 | |||
| 13 | class Window | ||
| 14 | { | ||
| 15 | public: | ||
| 16 | ~Window(); | ||
| 17 | |||
| 18 | /// Creates the window. | ||
| 19 | bool Initialise(int width, int height, const char* title); | ||
| 20 | |||
| 21 | /// Returns the native window handle. | ||
| 22 | /// If the window has not been initialized, returns an invalid handle. | ||
| 23 | HWND GetWindowHandle(); | ||
| 24 | |||
| 25 | /// Updates the window by polling for user input. | ||
| 26 | void Update(); | ||
| 27 | |||
| 28 | /// Returns true if the user tried to close the window, false otherwise. | ||
| 29 | bool ShouldClose() const; | ||
| 30 | |||
| 31 | private: | ||
| 32 | GLFWwindow* m_window = nullptr; | ||
| 33 | }; | ||
| 34 | |||
| 35 | /// Initialise the window subsystem. | ||
| 36 | /// | ||
| 37 | /// This function must be called at the start of your application before any | ||
| 38 | /// Windows are created. | ||
| 39 | bool WindowInitialise(); | ||
| 40 | |||
| 41 | /// Terminate the window subsystem. | ||
| 42 | /// | ||
| 43 | /// This function should be called at the end of your application. Any existing | ||
| 44 | /// Windows are destroyed and are invalid beyond this call. | ||
| 45 | void WindowTerminate(); | ||
| 46 | |||
| 47 | /// Returns the last Window error. | ||
| 48 | const char* GetWindowError(); | ||
| 49 | |||
| 50 | } // namespace dx | ||
