-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputManager.cpp
More file actions
35 lines (28 loc) · 1.15 KB
/
InputManager.cpp
File metadata and controls
35 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "InputManager.hpp"
namespace ArktisProductions
{
bool InputManager::IsSpriteClicked(sf::Sprite object, sf::Mouse::Button button, sf::RenderWindow &window)
{
if (sf::Mouse::isButtonPressed(button))
{
sf::IntRect playButtonRect(object.getPosition().x, object.getPosition().y, object.getGlobalBounds().width, object.getGlobalBounds().height);
if (playButtonRect.contains(sf::Mouse::getPosition(window)))
return true;
}
return false;
}
bool InputManager::IsTextClicked(sf::Text object, sf::Mouse::Button button, sf::RenderWindow &window)
{
if (sf::Mouse::isButtonPressed(button))
{
sf::IntRect playButtonRect(object.getPosition().x, object.getPosition().y, object.getGlobalBounds().width, object.getGlobalBounds().height);
if (playButtonRect.contains(sf::Mouse::getPosition(window)))
return true;
}
return false;
}
sf::Vector2i InputManager::GetMousePosition(sf::RenderWindow &window)
{
return sf::Mouse::getPosition(window);
}
}