sfInput Class Reference

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

#include <Input.hpp>

Inheritance diagram for sfInput:

sfWindowListener sfNonCopyable List of all members.

Public Member Functions

 sfInput ()
 Default constructor.
bool IsKeyDown (sfKey::Code Key) const
 Get the state of a key.
bool IsMouseButtonDown (sfMouse::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 X position.
unsigned int GetMouseY () const
 Get the mouse Y 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

sfInput 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 42 of file Input.hpp.


Constructor & Destructor Documentation

sfInput::sfInput (  ) 

Default constructor.

Definition at line 34 of file Input.cpp.


Member Function Documentation

bool sfInput::IsKeyDown ( sfKey::Code  Key  )  const

Get the state of a key.

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

Definition at line 62 of file Input.cpp.

bool sfInput::IsMouseButtonDown ( sfMouse::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 71 of file Input.cpp.

bool sfInput::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 87 of file Input.cpp.

unsigned int sfInput::GetMouseX (  )  const

Get the mouse X position.

Returns:
Current mouse left position, relative to owner window

Definition at line 99 of file Input.cpp.

unsigned int sfInput::GetMouseY (  )  const

Get the mouse Y position.

Returns:
Current mouse top position, relative to owner window

Definition at line 108 of file Input.cpp.

int sfInput::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 117 of file Input.cpp.

int sfInput::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 126 of file Input.cpp.

int sfInput::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 135 of file Input.cpp.


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