diff options
| author | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
| commit | 6ed978051668c08f5a957c97570f364dd580c807 (patch) | |
| tree | e3db93c52fcd86e26bc859d46e755290d2a7f40c /src/Window.cpp | |
| parent | 0464a83dfaebaa75d6e2d3b7431e84ebd83fccfd (diff) | |
| download | meowcraft-6ed978051668c08f5a957c97570f364dd580c807.tar.zst meowcraft-6ed978051668c08f5a957c97570f364dd580c807.zip | |
Namespace and Folder refactor
Diffstat (limited to 'src/Window.cpp')
| -rw-r--r-- | src/Window.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/Window.cpp b/src/Window.cpp deleted file mode 100644 index 2f1c2c0..0000000 --- a/src/Window.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include <stdexcept> -#include "Window.hpp" - -namespace MC { - -Window::Window(const char *title, uint32_t width, uint32_t height) { - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); - glfwWindowHint(GLFW_DOUBLEBUFFER, GL_TRUE); - - m_window = glfwCreateWindow(width, height, title, nullptr, nullptr); - if (m_window == nullptr) { - throw std::runtime_error("Failed to create window."); - } - - glfwMakeContextCurrent(m_window); - glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); -} - -Window::~Window() { - glfwDestroyWindow(m_window); -} - -bool Window::should_close() { - return glfwWindowShouldClose(m_window); -} - -GLFWwindow* Window::get() { - return m_window; -} - -void Window::close() { - glfwSetWindowShouldClose(m_window, true); -} - -bool Window::key(int key, int type) { - return (glfwGetKey(m_window, key) == type); -} - -void Window::start_frame() { - glfwSwapBuffers(m_window); - glfwPollEvents(); -} - -void Window::on_size_change(void (callback)(GLFWwindow*, int, int)) { - glfwSetFramebufferSizeCallback(m_window, static_cast<GLFWframebuffersizefun>(callback)); -} - -} \ No newline at end of file |
