Public Member Functions | |
~Input () | |
bool | down (Button btn) const |
Returns true if a button is currently pressed. | |
double | mouseX () const |
Returns the horizontal position of the mouse relative to the top left corner of the window given to Input's constructor. | |
double | mouseY () const |
See mouseX. | |
void | setMousePosition (double x, double y) |
Immediately moves the mouse as far towards the desired position as possible. | |
void | setMouseFactors (double factorX, double factorY) |
void | update () |
Collects new information about which buttons are pressed, where the mouse is and calls onButtonUp/onButtonDown, if assigned. | |
TextInput * | textInput () const |
Returns the currently active TextInput instance, or 0. | |
void | setTextInput (TextInput *input) |
Sets the currently active TextInput, or clears it (input = 0). | |
Static Public Member Functions | |
static wchar_t | idToChar (Button btn) |
Returns the character a button usually produces, or 0. | |
static Button | charToId (wchar_t ch) |
Returns the button that has to be pressed to produce the given character, or noButton. | |
Public Attributes | |
boost::function< void(Button)> | onButtonDown |
Assignable events that are called by update. | |
boost::function< void(Button)> | onButtonUp |
Only one Input instance can exist per application.
Definition at line 78 of file Input.hpp.
Gosu::Input::~Input | ( | ) |
static Button Gosu::Input::charToId | ( | wchar_t | ch | ) | [static] |
Returns the button that has to be pressed to produce the given character, or noButton.
bool Gosu::Input::down | ( | Button | btn | ) | const |
Returns true if a button is currently pressed.
Updated every tick.
static wchar_t Gosu::Input::idToChar | ( | Button | btn | ) | [static] |
Returns the character a button usually produces, or 0.
double Gosu::Input::mouseX | ( | ) | const |
Returns the horizontal position of the mouse relative to the top left corner of the window given to Input's constructor.
double Gosu::Input::mouseY | ( | ) | const |
See mouseX.
void Gosu::Input::setMouseFactors | ( | double | factorX, | |
double | factorY | |||
) |
void Gosu::Input::setMousePosition | ( | double | x, | |
double | y | |||
) |
Immediately moves the mouse as far towards the desired position as possible.
x and y are relativ to the window just as in the mouse position accessors.
void Gosu::Input::setTextInput | ( | TextInput * | input | ) |
Sets the currently active TextInput, or clears it (input = 0).
void Gosu::Input::update | ( | ) |
Collects new information about which buttons are pressed, where the mouse is and calls onButtonUp/onButtonDown, if assigned.
boost::function<void (Button)> Gosu::Input::onButtonDown |
boost::function<void (Button)> Gosu::Input::onButtonUp |