Handle the input given by the user.
More...
#include <InputManager.hpp>
|
| InputManager () |
| Construct a new Input Manager object. More...
|
|
| ~InputManager () |
| Destroy the Input Manager object. More...
|
|
bool | isSpriteClicked (sf::Sprite sprite, sf::Mouse::Button button, sf::RenderWindow &window) |
| Check whether a sprite is clicked or not. More...
|
|
sf::Vector2i | getMousePosition (sf::RenderWindow &window) |
| Get the Mouse Position object. More...
|
|
bool | isMoving (std::string direction, std::string player="p1") |
| Check whether the player is moving or not. More...
|
|
bool | isDoing (std::string action, std::string player="p1") |
| Check whether the player is performing a certain action or not. More...
|
|
Handle the input given by the user.
The class handles the input given by the user, whether it is the clicking of a button(sprite) or movement and action of the player in the main game.
◆ InputManager()
HeadBall::InputManager::InputManager |
( |
| ) |
|
|
inline |
Construct a new Input Manager object.
◆ ~InputManager()
HeadBall::InputManager::~InputManager |
( |
| ) |
|
|
inline |
Destroy the Input Manager object.
◆ getMousePosition()
sf::Vector2i HeadBall::InputManager::getMousePosition |
( |
sf::RenderWindow & |
window | ) |
|
Get the Mouse Position object.
- Parameters
-
window | The SFML render window object |
- Returns
- sf::Vector2i The position of the mouse in with respect to the render window object
◆ isDoing()
bool HeadBall::InputManager::isDoing |
( |
std::string |
action, |
|
|
std::string |
player = "p1" |
|
) |
| |
Check whether the player is performing a certain action or not.
- Parameters
-
action | The action : "kick" or "jump" |
player | The player : "p1" or "p2" |
- Returns
- true if the player is performing the action
-
false if the player is not performing the action
◆ isMoving()
bool HeadBall::InputManager::isMoving |
( |
std::string |
direction, |
|
|
std::string |
player = "p1" |
|
) |
| |
Check whether the player is moving or not.
- Parameters
-
direction | The direction : "left" or "right" |
player | The player : "p1" or "p2" |
- Returns
- true if the player is moving in certain direction
-
false if the player is not moving in certain direction
◆ isSpriteClicked()
bool HeadBall::InputManager::isSpriteClicked |
( |
sf::Sprite |
sprite, |
|
|
sf::Mouse::Button |
button, |
|
|
sf::RenderWindow & |
window |
|
) |
| |
Check whether a sprite is clicked or not.
- Parameters
-
sprite | Sprite which is to be checked |
button | The mouse button whose click is checked: left, right or middle |
window | The SFML render window object where the click is checked |
- Returns
- true if the sprite is clicked
-
false if the sprite is not clicked
The documentation for this class was generated from the following files: