Input.hpp 627 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <SFML/Window.hpp>
  3. #include <cstring>
  4. class Input
  5. {
  6. public:
  7. enum Type
  8. {
  9. RealTime = 1,
  10. Pressed = 1 << 1,
  11. Released = 1 << 2
  12. };
  13. Input() = delete;
  14. Input(const Input& other);
  15. Input& operator=(const Input& other);
  16. Input(const sf::Keyboard::Key& key, int type=Type::RealTime|Type::Pressed);
  17. Input(const sf::Mouse::Button& button, int type=Type::RealTime|Type::Pressed);
  18. bool test() const;
  19. bool operator==(const sf::Event& event) const;
  20. bool operator==(const Input& other) const;
  21. private:
  22. template<typename> friend class InputTarget;
  23. sf::Event _event;
  24. int _type;
  25. };