sf::Input Class Reference

Input handles real-time input from keyboard and mouse. More...

#include <Input.hpp>

Inheritance diagram for sf::Input:

sf::WindowListener sf::NonCopyable List of all members.

Public Member Functions

 Input ()
 Default constructor.
bool IsKeyDown (Key::Code KeyCode) const
 Get the state of a key.
bool IsMouseButtonDown (Mouse::Button Button) const
 Get the state of a mouse button.
bool IsJoystickButtonDown (unsigned int JoyId, unsigned int Button) const
 Get the state of a joystick button.
unsigned int GetMouseX () const
 Get the mouse left position.
unsigned int GetMouseY () const
 Get the mouse top position.
int GetJoystickX (unsigned int JoyId) const
 Get the joystick X position.
int GetJoystickY (unsigned int JoyId) const
 Get the joystick Y position.
int GetJoystickZ (unsigned int JoyId) const
 Get the joystick Z position.

Detailed Description

Input handles real-time input from keyboard and mouse.

Use it instead of events to handle continuous moves and more game-friendly inputs

Definition at line 44 of file Input.hpp.


Constructor & Destructor Documentation

sf::Input::Input (  ) 

Default constructor.

Definition at line 36 of file Input.cpp.


Member Function Documentation

bool sf::Input::IsKeyDown ( Key::Code  KeyCode  )  const

Get the state of a key.

Parameters:
KeyCode : Key to check
Returns:
True if key is down, false if key is up

Definition at line 64 of file Input.cpp.

bool sf::Input::IsMouseButtonDown ( Mouse::Button  Button  )  const

Get the state of a mouse button.

Parameters:
Button : Button to check
Returns:
True if button is down, false if button is up

Definition at line 73 of file Input.cpp.

bool sf::Input::IsJoystickButtonDown ( unsigned int  JoyId,
unsigned int  Button 
) const

Get the state of a joystick button.

Parameters:
JoyId : Identifier of the joystick to check (0 or 1)
Button : Button to check
Returns:
True if button is down, false if button is up

Definition at line 89 of file Input.cpp.

unsigned int sf::Input::GetMouseX (  )  const

Get the mouse left position.

Returns:
Current mouse left position, relative to owner window

Definition at line 101 of file Input.cpp.

unsigned int sf::Input::GetMouseY (  )  const

Get the mouse top position.

Returns:
Current mouse top position, relative to owner window

Definition at line 110 of file Input.cpp.

int sf::Input::GetJoystickX ( unsigned int  JoyId  )  const

Get the joystick X position.

Parameters:
JoyId : Identifier of the joystick to check (0 or 1)
Returns:
Current joystick X position, in the range [-100, 100]

Definition at line 119 of file Input.cpp.

int sf::Input::GetJoystickY ( unsigned int  JoyId  )  const

Get the joystick Y position.

Parameters:
JoyId : Identifier of the joystick to check (0 or 1)
Returns:
Current joystick Y position, in the range [-100, 100]

Definition at line 128 of file Input.cpp.

int sf::Input::GetJoystickZ ( unsigned int  JoyId  )  const

Get the joystick Z position.

Parameters:
JoyId : Identifier of the joystick to check (0 or 1)
Returns:
Current joystick Z position, in the range [-100, 100]

Definition at line 137 of file Input.cpp.


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