Annchienta::InputManager Class Reference
List of all members.
Detailed Description
Used to handle input tasks. Remember to call
update() every frame.
Constructor & Destructor Documentation
Annchienta::InputManager::InputManager |
( |
|
) |
|
Annchienta::InputManager::~InputManager |
( |
|
) |
|
Member Function Documentation
bool Annchienta::InputManager::buttonDown |
( |
int |
code |
) |
const |
- Parameters:
-
| code | 0 for left mouse button, 1 for right mouse button. |
- Returns:
- Is the given button currently down?
bool Annchienta::InputManager::buttonTicked |
( |
int |
code |
) |
const |
- Parameters:
-
| code | 0 for left mouse button, 1 for right mouse button. |
- Returns:
- Is the given button ticked? (See keyTicked())
bool Annchienta::InputManager::cancelKeyTicked |
( |
|
) |
const |
- Returns:
- Quick check for cancel key.
bool Annchienta::InputManager::clicked |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2 | |
|
) |
| | const |
Checks if a certain area is clicked.
- Returns:
- Was this area clicked since the last update()?
int Annchienta::InputManager::getCancelKey |
( |
|
) |
const |
Person* Annchienta::InputManager::getInputControlledPerson |
( |
|
) |
const |
- Returns:
- Obtain the Person controlled by the user.
InputMode Annchienta::InputManager::getInputMode |
( |
|
) |
const |
int Annchienta::InputManager::getInteractKey |
( |
|
) |
const |
Point Annchienta::InputManager::getMousePoint |
( |
|
) |
const |
- Returns:
- A Point indicating mouse coordinates.
int Annchienta::InputManager::getMouseX |
( |
|
) |
const |
int Annchienta::InputManager::getMouseY |
( |
|
) |
const |
bool Annchienta::InputManager::hover |
( |
int |
x1, |
|
|
int |
y1, |
|
|
int |
x2, |
|
|
int |
y2 | |
|
) |
| | const |
Checks if the mouse is in a given rectangle.
- Parameters:
-
| x1 | Left X of that rectangle. |
| y1 | Top Y of that rectangle. |
| x2 | Right X of that rectangle. |
| y2 | Bottom Y of that rectangle. |
- Returns:
- Is the mouse in that area?
bool Annchienta::InputManager::interactKeyTicked |
( |
|
) |
const |
- Returns:
- Quick check for interact key.
bool Annchienta::InputManager::isMouseMoved |
( |
|
) |
const |
- Returns:
- Is the mouse moved since the last update?
bool Annchienta::InputManager::isRunning |
( |
|
) |
|
This function should be called if you want to know if the engine is still running. This function will return false if the user closed the window.
- Returns:
- Whether the engine is still running or not.
bool Annchienta::InputManager::keyDown |
( |
int |
code |
) |
const |
- Parameters:
-
- Returns:
- Is the given key pressed down?
bool Annchienta::InputManager::keyTicked |
( |
int |
code |
) |
const |
This is a function like keyDown(), but slightly different: this function only returns true if the key was ticked since the last update. That means that, even when the user keeps pressing the key, this function will only return true the first time. Quite useful for menus and things like that.
- Parameters:
-
- Returns:
- Is the given key ticked?
void Annchienta::InputManager::setCancelKey |
( |
int |
code |
) |
|
Set the default cancel key.
- Parameters:
-
void Annchienta::InputManager::setInputControlledPerson |
( |
Person * |
person |
) |
|
Sets the Person controlled by input. If there already is one, the previous setting will be overwritten.
- Parameters:
-
| person | The Person to be controlled by the user. |
void Annchienta::InputManager::setInputMode |
( |
InputMode |
mode |
) |
|
void Annchienta::InputManager::setInteractKey |
( |
int |
code |
) |
|
Sets the default interact key.
- Parameters:
-
void Annchienta::InputManager::setMouseVisibility |
( |
bool |
value |
) |
const |
- Parameters:
-
| value | Whether the mouse should be visible or not. |
void Annchienta::InputManager::stop |
( |
|
) |
|
Stops the game. running() will return false from now on.
void Annchienta::InputManager::update |
( |
|
) |
|
Updates all keys to their current state.
Member Data Documentation