Simple mouse clicks working but probably wrong coordinates.
This commit is contained in:
parent
64855f3c90
commit
d36c42038d
1 changed files with 7 additions and 0 deletions
7
gui.cpp
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…
Add table
Add a link
Reference in a new issue