Input.hpp 776 B

123456789101112131415161718192021222324252627282930313233
  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. Input(const int joystickButton, int type=Type::RealTime|Type::Pressed);
  19. Input(const sf::Joystick::Axis& axis, bool positive);
  20. float test() const;
  21. bool operator==(const sf::Event& event) const;
  22. bool operator==(const Input& other) const;
  23. private:
  24. template<typename> friend class InputTarget;
  25. sf::Event _event;
  26. int _type;
  27. bool _positive;
  28. };