fix mouse picking

This commit is contained in:
2023-06-03 20:43:40 +02:00
parent cb5f5a4cf8
commit 193e4db651
6 changed files with 67 additions and 65 deletions

View File

@@ -169,7 +169,7 @@ void WorldRenderer::Click() {
void WorldRenderer::SetCamPos(float camX, float camY) {
m_CamPos = { camX, camY };
m_Renderer->SetCamPos(m_CamPos);
m_Renderer->SetCamPos({ camX, 50, camY });
}
void WorldRenderer::DetectClick() {
@@ -232,11 +232,11 @@ void WorldRenderer::OnTowerRemove(game::TowerPtr tower) {
Vec2f WorldRenderer::GetCursorWorldPos() const {
ImGuiIO& io = ImGui::GetIO();
return m_Renderer->GetCursorWorldPos({ io.MousePos.x, io.MousePos.y }, Display::GetAspectRatio(), m_Zoom, Display::GetWindowWidth(), Display::GetWindowHeight());
return m_Renderer->GetCursorWorldPos({ io.MousePos.x, io.MousePos.y }, Display::GetWindowWidth(), Display::GetWindowHeight());
}
Vec2f WorldRenderer::GetClickWorldPos() const {
return m_Renderer->GetCursorWorldPos(m_LastClicked, Display::GetAspectRatio(), m_Zoom, Display::GetWindowWidth(), Display::GetWindowHeight());
return m_Renderer->GetCursorWorldPos(m_LastClicked, Display::GetWindowWidth(), Display::GetWindowHeight());
}
} // namespace render