From 556cf073d61875368fe8511b75f5cb7db04ccb52 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Wed, 19 Nov 2025 11:24:21 -0800 Subject: Use C++ modules --- dxwindow/src/dxwindow.cc | 80 ------------------------------------------------ 1 file changed, 80 deletions(-) delete mode 100644 dxwindow/src/dxwindow.cc (limited to 'dxwindow/src') diff --git a/dxwindow/src/dxwindow.cc b/dxwindow/src/dxwindow.cc deleted file mode 100644 index 8848a7e..0000000 --- a/dxwindow/src/dxwindow.cc +++ /dev/null @@ -1,80 +0,0 @@ -#include "dxwindow.h" - -#define GLFW_EXPOSE_NATIVE_WIN32 -#include - -#include -#include - -namespace dx -{ - -static char glfw_error[1024] = {}; - -static void glfw_error_callback(int error, const char* description) -{ - sprintf_s(glfw_error, sizeof(glfw_error), - "GLFW error %d: %s", error, description); -} - -Window::~Window() -{ - if (m_window != nullptr) - { - glfwDestroyWindow(m_window); - } -} - -bool Window::Initialise(int width, int height, const char* title) -{ - // GLFW by default creates an OpenGL context with the window. - // Use GLFW_NO_API to tell it not to do so. - glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); - - if ((m_window = glfwCreateWindow( - width, height, title, /*monitor=*/NULL, /*share=*/NULL)) == nullptr) - { - return false; - } - - return true; -} - -HWND Window::GetWindowHandle() -{ - if (!m_window) - { - return NULL; - } - return glfwGetWin32Window(m_window); -} - -void Window::Update() -{ - assert(m_window); - glfwPollEvents(); -} - -bool Window::ShouldClose() const -{ - assert(m_window); - return glfwWindowShouldClose(m_window) == GLFW_TRUE; -} - -bool WindowInitialise() -{ - glfwSetErrorCallback(glfw_error_callback); - return glfwInit() == GLFW_TRUE; -} - -void WindowTerminate() -{ - glfwTerminate(); -} - -const char* GetWindowError() -{ - return glfw_error; -} - -} // namespace dx -- cgit v1.2.3