Simple mouse clicks working but probably wrong coordinates.

main
Zed A. Shaw 1 week ago
parent 64855f3c90
commit d36c42038d
  1. 7
      gui.cpp

@ -200,6 +200,13 @@ bool GUI::handle_ui_events() {
} else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Enter)) {
$status_ui.$component->OnEvent(Event::Return);
}
} else if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
sf::Vector2i pos = sf::Mouse::getPosition($renderer.$window);
Mouse mev;
mev.button = Mouse::Button::Left,
mev.x=pos.x / $renderer.$ui_bounds.width; // this needs to be in...panel coordinates?
mev.y=pos.y / $renderer.$ui_bounds.height;
$status_ui.$component->OnEvent(Event::Mouse("", mev));
}
}

Loading…
Cancel
Save