From 1e0682c7a5cd6d4605f8898088813a029ce73c93 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Mon, 11 Jan 2021 00:26:30 +0100 Subject: [PATCH] Rename Application::get() singleton to the() --- inferno/src/inferno/application.h | 2 +- inferno/src/inferno/input.cpp | 10 +++++----- inferno/src/inferno/render/camera.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inferno/src/inferno/application.h b/inferno/src/inferno/application.h index e1dbfc6..455e6a4 100644 --- a/inferno/src/inferno/application.h +++ b/inferno/src/inferno/application.h @@ -36,7 +36,7 @@ namespace Inferno { inline Window& getWindow() const { return *m_window; } - static inline Application& get() { return *s_instance; } + static inline Application& the() { return *s_instance; } private: std::unique_ptr m_window; diff --git a/inferno/src/inferno/input.cpp b/inferno/src/inferno/input.cpp index b102009..0ab5ec6 100644 --- a/inferno/src/inferno/input.cpp +++ b/inferno/src/inferno/input.cpp @@ -17,8 +17,8 @@ namespace Inferno { void Input::initialize() { // Set cursor in the middle of the screen - m_xPosLast = Application::get().getWindow().getWidth() / 2.0f; - m_yPosLast = Application::get().getWindow().getHeight() / 2.0f; + m_xPosLast = Application::the().getWindow().getWidth() / 2.0f; + m_yPosLast = Application::the().getWindow().getHeight() / 2.0f; dbg(Log::Info) << "Input initialized"; } @@ -50,19 +50,19 @@ namespace Inferno { bool Input::isKeyPressed(int key) { - GLFWwindow* w = Application::get().getWindow().getWindow(); + GLFWwindow* w = Application::the().getWindow().getWindow(); return glfwGetKey(w, key) == GLFW_PRESS; } bool Input::isMouseButtonPressed(int button) { - GLFWwindow* w = Application::get().getWindow().getWindow(); + GLFWwindow* w = Application::the().getWindow().getWindow(); return glfwGetMouseButton(w, button) == GLFW_PRESS; } std::pair Input::getMousePosition() { - GLFWwindow* w = Application::get().getWindow().getWindow(); + GLFWwindow* w = Application::the().getWindow().getWindow(); double xPos; double yPos; glfwGetCursorPos(w, &xPos, &yPos); diff --git a/inferno/src/inferno/render/camera.cpp b/inferno/src/inferno/render/camera.cpp index 3f6e0f0..a31e451 100644 --- a/inferno/src/inferno/render/camera.cpp +++ b/inferno/src/inferno/render/camera.cpp @@ -117,7 +117,7 @@ namespace Inferno { transform()->setTransform(glm::inverse(transform()->transform())); // View space -> Clip space: projection matrix - float aspectRatio = Application::get().getWindow().getAspect(); + float aspectRatio = Application::the().getWindow().getAspect(); setProjection(glm::ortho(-aspectRatio * m_zoomLevel, aspectRatio * m_zoomLevel, -m_zoomLevel, m_zoomLevel, -1.0f, 1.0f)); // Clip space -> Screen space: viewport transform @@ -214,7 +214,7 @@ namespace Inferno { transform()->setTransform(glm::lookAt(transform()->translate(), transform()->translate() + transform()->rotate(), m_up)); // View space -> Clip space: projection matrix - float aspect = Application::get().getWindow().getAspect(); + float aspect = Application::the().getWindow().getAspect(); setProjection(glm::perspective(glm::radians(m_fov), aspect, NEAR_PLANE, FAR_PLANE)); // Clip space -> Screen space: viewport transform