From 5c53307cebeaf37dbd2c22e022800a396583a436 Mon Sep 17 00:00:00 2001 From: JustDoom <61824552+JustDoom@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:06:53 +1000 Subject: [PATCH] Update some methods I forgot to update --- src/sfml/Emulator.cpp | 1 + src/sfml/MainMenu.cpp | 2 +- src/sfml/ui/TextButton.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sfml/Emulator.cpp b/src/sfml/Emulator.cpp index ec2cc41..834bd84 100644 --- a/src/sfml/Emulator.cpp +++ b/src/sfml/Emulator.cpp @@ -53,6 +53,7 @@ int Emulator::launch(const std::string &rom) { // TODO: You can hold down the button and it will run at the next possible point // fix this but make it a little easier to time because otherwise you need to time it perfectly which doesnt feel good + // ^ if the InputHandler was to be used anyway // Handle keyboard inputs if (event.type == sf::Event::KeyPressed) { keyboard.handleKeyDown(event.key.code); diff --git a/src/sfml/MainMenu.cpp b/src/sfml/MainMenu.cpp index e175e0e..0484b46 100644 --- a/src/sfml/MainMenu.cpp +++ b/src/sfml/MainMenu.cpp @@ -104,7 +104,7 @@ MainMenu::MainMenu(std::unordered_map>& } button.update(&this->inputHandler, pos); - if (button.isClicked()) { + if (button.isJustClicked()) { nfdchar_t* outPath = nullptr; nfdresult_t result = NFD_PickFolder(nullptr, &outPath); diff --git a/src/sfml/ui/TextButton.cpp b/src/sfml/ui/TextButton.cpp index 76ca896..c729372 100644 --- a/src/sfml/ui/TextButton.cpp +++ b/src/sfml/ui/TextButton.cpp @@ -36,7 +36,7 @@ void TextButton::update(InputHandler* inputHandler, sf::Vector2i pos) { this->lastPressed = this->isPressed; this->isHovered = this->button.getGlobalBounds().contains(pos.x, pos.y); - if (this->isHovered && inputHandler->isClicked(sf::Mouse::Left)) { + if (this->isHovered && inputHandler->isJustClicked(sf::Mouse::Left)) { this->isPressed = true; updateColour(this->activeColor); } else if (this->isHovered && inputHandler->isPressed(sf::Keyboard::Key::LShift)) {