Public Member Functions | |
bool | down (Button btn) const |
double | mouseX () const |
double | mouseY () const |
void | setMousePosition (double x, double y) |
void | setMouseFactors (double factorX, double factorY) |
void | update () |
TextInput * | textInput () const |
void | setTextInput (TextInput *input) |
Static Public Member Functions | |
static wchar_t | idToChar (Button btn) |
static Button | charToId (wchar_t ch) |
Public Attributes | |
boost::function< void(Button)> | onButtonDown |
boost::function< void(Button)> | onButtonUp |
Only one Input instance can exist per application.
static wchar_t Gosu::Input::idToChar | ( | Button | btn | ) | [static] |
Returns the character a button usually produces, or 0.
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.
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::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::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 |
Assignable events that are called by update.
You can bind these to your own functions. If you use the Window class, it will assign forward these to its own methods.