Gosu::Input Class Reference

Manages initialization and shutdown of the input system. More...

List of all members.

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 ()
TextInputtextInput () 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


Detailed Description

Manages initialization and shutdown of the input system.

Only one Input instance can exist per application.


Member Function Documentation

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.


Member Data Documentation

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.


The documentation for this class was generated from the following file:

Generated on Sat Feb 7 22:34:53 2009 for Gosu by  doxygen 1.5.5