Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for removed Event Inheritance #287

Merged
merged 2 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/minimal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ int main() {
sf::Clock deltaClock;
while (window.isOpen()) {
while (const auto event = window.pollEvent()) {
ImGui::SFML::ProcessEvent(window, event);
ImGui::SFML::ProcessEvent(window, *event);

if (event.is<sf::Event::Closed>()) {
if (event->is<sf::Event::Closed>()) {
window.close();
}
}
Expand Down
8 changes: 4 additions & 4 deletions examples/multiple_windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ int main() {
while (window.isOpen()) {
// Main window event processing
while (const auto event = window.pollEvent()) {
ImGui::SFML::ProcessEvent(window, event);
if (event.is<sf::Event::Closed>()) {
ImGui::SFML::ProcessEvent(window, *event);
if (event->is<sf::Event::Closed>()) {
if (childWindow.isOpen()) {
childWindow.close();
}
Expand All @@ -31,8 +31,8 @@ int main() {
// Child window event processing
if (childWindow.isOpen()) {
while (const auto event = childWindow.pollEvent()) {
ImGui::SFML::ProcessEvent(childWindow, event);
if (event.is<sf::Event::Closed>()) {
ImGui::SFML::ProcessEvent(childWindow, *event);
if (event->is<sf::Event::Closed>()) {
childWindow.close();
ImGui::SFML::Shutdown(childWindow);
}
Expand Down
2 changes: 1 addition & 1 deletion imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void ProcessEvent(const sf::Window& window, const sf::Event& event) {
io.AddMouseWheelEvent(mouseWheelScrolled->delta, 0);
}
}
const auto handleKeyChanged = [&io](const sf::Event::KeyChanged& keyChanged, bool down) {
const auto handleKeyChanged = [&io](const auto& keyChanged, bool down) {
const ImGuiKey mod = keycodeToImGuiMod(keyChanged.code);
// The modifier booleans are not reliable when it's the modifier
// itself that's being pressed. Detect these presses directly.
Expand Down