From 8a0b2a59c9809d5fc8e6a30c2abc4d5af21aa39e Mon Sep 17 00:00:00 2001 From: hachem Date: Wed, 13 Aug 2025 18:39:13 +0200 Subject: [fix]: More consistent formatting --- src/Core/Window.cpp | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'src/Core/Window.cpp') diff --git a/src/Core/Window.cpp b/src/Core/Window.cpp index ff451fd..853abb0 100644 --- a/src/Core/Window.cpp +++ b/src/Core/Window.cpp @@ -1,11 +1,10 @@ #include "Window.h" #include #include -#include namespace Donut { - static bool s_GLFWInitialized = false; + static bool s_GLFWInitialized = false; static uint32_t s_GLFWWindowCount = 0; Window::Window(const std::string& title, int width, int height) @@ -43,26 +42,18 @@ namespace Donut } glfwMakeContextCurrent(m_Window); - - if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) - { - std::cout << "Failed to initialize GLAD!" << std::endl; - glfwTerminate(); - return; - } - glfwSetWindowUserPointer(m_Window, this); glfwSetErrorCallback(GLFWErrorCallback); glfwSetWindowCloseCallback(m_Window, GLFWWindowCloseCallback); - glfwSetWindowSizeCallback(m_Window, GLFWWindowSizeCallback); + glfwSetWindowSizeCallback(m_Window, GLFWWindowSizeCallback); glfwSetWindowFocusCallback(m_Window, GLFWWindowFocusCallback); - glfwSetWindowPosCallback(m_Window, GLFWWindowPosCallback); - glfwSetKeyCallback(m_Window, GLFWKeyCallback); - glfwSetCharCallback(m_Window, GLFWCharCallback); + glfwSetWindowPosCallback(m_Window, GLFWWindowPosCallback); + glfwSetKeyCallback(m_Window, GLFWKeyCallback); + glfwSetCharCallback(m_Window, GLFWCharCallback); glfwSetMouseButtonCallback(m_Window, GLFWMouseButtonCallback); - glfwSetScrollCallback(m_Window, GLFWMouseScrollCallback); - glfwSetCursorPosCallback(m_Window, GLFWCursorPosCallback); + glfwSetScrollCallback(m_Window, GLFWMouseScrollCallback); + glfwSetCursorPosCallback(m_Window, GLFWCursorPosCallback); s_GLFWWindowCount++; } @@ -93,19 +84,15 @@ namespace Donut void Window::SetCursorLocked(bool locked) { m_CursorLocked = locked; - if (locked) - glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); - else - glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + glfwSetInputMode(m_Window, GLFW_CURSOR, locked ? + GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL); } void Window::SetCursorVisible(bool visible) { m_CursorVisible = visible; - if (visible) - glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); - else - glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + glfwSetInputMode(m_Window, GLFW_CURSOR, visible ? + GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN); } void Window::GLFWErrorCallback(int error, const char* description) @@ -153,7 +140,8 @@ namespace Donut win->m_EventHandler.OnEvent(event); } - void Window::GLFWKeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods) + void Window::GLFWKeyCallback(GLFWwindow* window, int key, int scancode, + int action, int mods) { Window* win = static_cast(glfwGetWindowUserPointer(window)); @@ -184,7 +172,8 @@ namespace Donut win->m_EventHandler.OnEvent(event); } - void Window::GLFWMouseButtonCallback(GLFWwindow* window, int button, int action, int mods) + void Window::GLFWMouseButtonCallback(GLFWwindow* window, int button, + int action, int mods) { Window* win = static_cast(glfwGetWindowUserPointer(window)); @@ -199,8 +188,7 @@ namespace Donut { MouseButtonReleasedEvent event(button); win->m_EventHandler.OnEvent(event); - break; - } + } break; } } -- cgit v1.3