R-Type
Mouse.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** R-Type
4 ** File description:
5 ** Mouse
6 */
7 
8 #ifndef MOUSE_HPP_
9 #define MOUSE_HPP_
10 #include <SFML/Window/Mouse.hpp>
11 #include "utils/SfmlTypes.hpp"
12 #include "utils/Vector.hpp"
13 
14 namespace GameEngine
15 {
16  namespace Input
17  {
18  namespace Mouse
19  {
20  enum Key {
25  };
26  static bool isKeyPressed(const Input::Mouse::Key key)
27  {
28  return sf::Mouse::isButtonPressed(sf::Mouse::Button(key));
29  }
30  static Vector2<int> getPosition(const Window &relativeTo)
31  {
32  sf::Vector2<int> pos = sf::Mouse::getPosition(relativeTo.getWindow());
33  return Vector2<int>{pos.x, pos.y};
34  }
35  } // namespace Mouse
36  } // namespace Input
37 } // namespace GameEngine
38 
39 #endif /* !MOUSE_HPP_ */
a Vector2 class
Definition: Vector.hpp:20
T x
Definition: Vector.hpp:98
Class representing a window wrapper for sf::RenderWindow with additional functionality.
Definition: SfmlTypes.hpp:118
const sf::RenderWindow & getWindow() const override
Returns the wrapped sf::RenderWindow.
Definition: SfmlTypes.hpp:141
Key
Definition: Mouse.hpp:20
@ Middle
Definition: Mouse.hpp:24
@ NO_KEY
Definition: Mouse.hpp:21
@ Left
Definition: Mouse.hpp:22
@ Right
Definition: Mouse.hpp:23
Definition: AssetManager.hpp:15