Skip to content

Commit 755e443

Browse files
Adjust mouse aim
1 parent 6dc6049 commit 755e443

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/features/player/systems/playerInput.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,14 @@ namespace features::player::systems
3535

3636
dir = normalize(dir);
3737

38-
sf::Vector2f mousePos = static_cast<sf::Vector2f>(sf::Mouse::getPosition(window));
38+
auto mousePos = window.mapPixelToCoords(sf::Mouse::getPosition(window));
3939

4040
auto view = registry.view<features::player::components::playerControlled, common::components::position>();
4141
for (auto [entityUnit, playerControlled, pos] : view.each())
4242
{
4343
sf::Vector2f dirVec = {mousePos.x - pos.x, mousePos.y - pos.y};
4444
dirVec = normalize(dirVec);
4545

46-
std::cout << "mousePos: " << mousePos.x << " " << mousePos.y << std::endl;
47-
std::cout << "pos: " << pos.x << " " << pos.y << std::endl;
48-
std::cout << "dirVec: " << dirVec.x << " " << dirVec.y << std::endl;
49-
5046
registry.replace<common::components::direction>(entityUnit, dir.x, dir.y);
5147
registry.emplace_or_replace<common::components::lookDirection>(entityUnit, dirVec.x, dirVec.y);
5248

0 commit comments

Comments
 (0)