Input Handling
Input Interface
#pragma once
#include <SFML/Window/Keyboard.hpp>
namespace ng {
/// @brief Manages keyboard input, tracking key presses, holds, and releases.
class Input {
public:
/// @brief Checks if a specific key was pressed down (went from not pressed to pressed) in the current frame.
/// @param key The SFML scancode of the key to check.
/// @return True if the key was pressed down, false otherwise.
[[nodiscard]] bool GetKeyDown(sf::Keyboard::Scancode key) const;
/// @brief Checks if a specific key is currently being held down.
/// @param key The SFML scancode of the key to check.
/// @return True if the key is currently pressed, false otherwise.
[[nodiscard]] bool GetKey(sf::Keyboard::Scancode key) const;
/// @brief Checks if a specific key was released (went from pressed to not pressed) in the current frame.
/// @param key The SFML scancode of the key to check.
/// @return True if the key was released, false otherwise.
[[nodiscard]] bool GetKeyUp(sf::Keyboard::Scancode key) const;
};
} // namespace ngKey State
Input Event Detection
Last updated