Browse Source

Engine: Rename getWindow() => window()

master
Riyyi 2 years ago
parent
commit
aec1a80623
  1. 2
      src/inferno/application.h
  2. 10
      src/inferno/io/input.cpp
  3. 4
      src/inferno/system/camerasystem.cpp
  4. 4
      src/inferno/system/textareasystem.cpp
  5. 2
      src/inferno/window.cpp

2
src/inferno/application.h

@ -38,7 +38,7 @@ public:
inline void setStatus(int status) { m_status = status; }
inline Window& getWindow() const { return *m_window; }
inline Window& window() const { return *m_window; }
static Application& the() { return *s_instance; }

10
src/inferno/io/input.cpp

@ -23,8 +23,8 @@ float Input::m_yOffset = 0.0f;
void Input::initialize()
{
// Set cursor in the middle of the screen
m_xPosLast = Application::the().getWindow().getWidth() / 2.0f;
m_yPosLast = Application::the().getWindow().getHeight() / 2.0f;
m_xPosLast = Application::the().window().getWidth() / 2.0f;
m_yPosLast = Application::the().window().getHeight() / 2.0f;
ruc::info("Input initialized");
}
@ -56,19 +56,19 @@ bool Input::onMousePosition(MousePositionEvent& e)
bool Input::isKeyPressed(int key)
{
GLFWwindow* w = Application::the().getWindow().getWindow();
GLFWwindow* w = Application::the().window().getWindow();
return glfwGetKey(w, key) == GLFW_PRESS;
}
bool Input::isMouseButtonPressed(int button)
{
GLFWwindow* w = Application::the().getWindow().getWindow();
GLFWwindow* w = Application::the().window().getWindow();
return glfwGetMouseButton(w, button) == GLFW_PRESS;
}
std::pair<float, float> Input::getMousePosition()
{
GLFWwindow* w = Application::the().getWindow().getWindow();
GLFWwindow* w = Application::the().window().getWindow();
double xPos;
double yPos;
glfwGetCursorPos(w, &xPos, &yPos);

4
src/inferno/system/camerasystem.cpp

@ -69,7 +69,7 @@ void CameraSystem::updateOrthographic(TransformComponent& transform, CameraCompo
transform.transform = { glm::inverse(transform.transform) };
// View space -> Clip space: projection matrix
float aspectRatio = Application::the().getWindow().getAspect();
float aspectRatio = Application::the().window().getAspect();
camera.projection = {
glm::ortho(-aspectRatio * camera.zoomLevel, aspectRatio * camera.zoomLevel,
-camera.zoomLevel, camera.zoomLevel, -1.0f, 1.0f)
@ -90,7 +90,7 @@ void CameraSystem::updatePerspective(TransformComponent& transform, CameraCompon
transform.transform = { glm::lookAt(transform.translate, transform.translate + transform.rotate, camera.up) };
// View space -> Clip space: projection matrix
float aspect = Application::the().getWindow().getAspect();
float aspect = Application::the().window().getAspect();
camera.projection = { glm::perspective(glm::radians(camera.fov), aspect, NEAR_PLANE, FAR_PLANE) };
// Clip space -> Screen space: viewport transform

4
src/inferno/system/textareasystem.cpp

@ -32,8 +32,8 @@ void TextAreaSystem::render()
auto view = m_scene->registry()->view<TransformComponent, TextAreaComponent>();
glm::ivec2 viewport = {
Application::the().getWindow().getWidth(),
Application::the().getWindow().getHeight(),
Application::the().window().getWidth(),
Application::the().window().getHeight(),
};
for (auto [entity, transform, textarea] : view.each()) {

2
src/inferno/window.cpp

@ -214,7 +214,7 @@ void Window::signalCallback(int signal)
if (signal == SIGINT || signal == SIGTERM) {
WindowCloseEvent e;
Application::the().getWindow().m_eventCallback(e);
Application::the().window().m_eventCallback(e);
}
}

Loading…
Cancel
Save