Fix mouse coordinates

This commit is contained in:
Shylie 2024-06-13 18:08:02 -04:00
parent 139681a3fd
commit e402b5f5a3

View File

@ -800,7 +800,7 @@ namespace glerminal
{ {
glerminal* const self = static_cast<glerminal*>(glfwGetWindowUserPointer(window)); glerminal* const self = static_cast<glerminal*>(glfwGetWindowUserPointer(window));
if (self->m_mousemoved) { self->m_mousemoved(x / CELL_SIZE, y / CELL_SIZE); } if (self->m_mousemoved) { self->m_mousemoved(x / (CELL_SIZE * CELL_SCALE), y / (CELL_SIZE * CELL_SCALE)); }
} }
void glerminal::glfw_mousepress_handler(GLFWwindow *window, int button, int action, int mods) void glerminal::glfw_mousepress_handler(GLFWwindow *window, int button, int action, int mods)
@ -812,12 +812,12 @@ namespace glerminal
if (self->m_mousepressed && action == GLFW_PRESS) if (self->m_mousepressed && action == GLFW_PRESS)
{ {
self->m_mousepressed(button, x / CELL_SIZE, y / CELL_SIZE); self->m_mousepressed(button, x / (CELL_SIZE * CELL_SCALE), y / (CELL_SIZE * CELL_SCALE));
} }
if (self->m_mousereleased && action == GLFW_RELEASE) if (self->m_mousereleased && action == GLFW_RELEASE)
{ {
self->m_mousereleased(button, x / CELL_SIZE, y / CELL_SIZE); self->m_mousereleased(button, x / (CELL_SIZE * CELL_SCALE), y / (CELL_SIZE * CELL_SCALE));
} }
} }