Engine::InputDevice Class Reference

A keyboard, mouse, gamepad, joystick, wiimote, player on the other end of a network, or AI. More...

#include <InputDevice.h>

Inheritance diagram for Engine::InputDevice:

Engine::InputDeviceAI Engine::InputDeviceJoystick Engine::InputDeviceKeyboard Engine::InputDeviceReplay List of all members.

Public Member Functions

 InputDevice ()
virtual ~InputDevice ()
virtual int get_acceleration ()=0
 Get a number representing the acceleration or breaking.
virtual int get_slide ()=0
 Sideways force .
virtual int get_steering ()=0
 Stearing angle.
virtual void poll ()
 Poll for events, if necessary.
virtual void set_scene (Scene &scene)
virtual void set_car (GameObjects::Car *car)
std::set< InputDevice
* >::iterator 
get_handle () const

Protected Member Functions

void report (InputReport::ReportType type, int value=0)
 Make a report, then submit it the car and scene as required.

Protected Attributes

Scenescene
GameObjects::Carcar
std::set< InputDevice
* >::iterator 
handler_reference

Detailed Description

A keyboard, mouse, gamepad, joystick, wiimote, player on the other end of a network, or AI.

This is where input device abstraction is done. Different types of InputDevices can be created that are subclasses of this class, then anything wishing to get input from any type of input device can use a consistant interface.

Definition at line 31 of file InputDevice.h.


Constructor & Destructor Documentation

Engine::InputDevice::InputDevice (  ) 

Definition at line 18 of file InputDevice.cpp.

Engine::InputDevice::~InputDevice (  )  [virtual]

Definition at line 25 of file InputDevice.cpp.


Member Function Documentation

virtual int Engine::InputDevice::get_acceleration (  )  [pure virtual]

Get a number representing the acceleration or breaking.

Returns:
A number from -32767 to 32767 giving the amount of accelerating or breaking to do: 0 if not accelerating or braking, a negative value for breaking, a positive value for acceleration.

Implemented in Engine::InputDeviceAI, Engine::InputDeviceJoystick, Engine::InputDeviceKeyboard, and Engine::InputDeviceReplay.

std::set< InputDevice * >::iterator Engine::InputDevice::get_handle (  )  const

Definition at line 40 of file InputDevice.cpp.

virtual int Engine::InputDevice::get_slide (  )  [pure virtual]

Sideways force .

Returns:
a number between -32767 (maximum left) and +32767 (maximum right). 0 indicates no sliding.

Implemented in Engine::InputDeviceAI, Engine::InputDeviceJoystick, Engine::InputDeviceKeyboard, and Engine::InputDeviceReplay.

virtual int Engine::InputDevice::get_steering (  )  [pure virtual]

Stearing angle.

Returns:
a number between -32767 (maximum left) and 32767 (maximum right). 0 is straight ahead.

Implemented in Engine::InputDeviceAI, Engine::InputDeviceJoystick, Engine::InputDeviceKeyboard, and Engine::InputDeviceReplay.

virtual void Engine::InputDevice::poll (  )  [inline, virtual]

Poll for events, if necessary.

Reimplemented in Engine::InputDeviceAI, Engine::InputDeviceJoystick, and Engine::InputDeviceKeyboard.

Definition at line 57 of file InputDevice.h.

void Engine::InputDevice::report ( InputReport::ReportType  type,
int  value = 0 
) [protected]

Make a report, then submit it the car and scene as required.

Parameters:
type The classification of the event that occured.
value The new value for steering, slide, and acceleration changed events.

Definition at line 45 of file InputDevice.cpp.

void Engine::InputDevice::set_car ( GameObjects::Car car  )  [virtual]

Definition at line 35 of file InputDevice.cpp.

void Engine::InputDevice::set_scene ( Scene scene  )  [virtual]

Definition at line 30 of file InputDevice.cpp.


Member Data Documentation

GameObjects::Car* Engine::InputDevice::car [protected]

Definition at line 66 of file InputDevice.h.

std::set<InputDevice *>::iterator Engine::InputDevice::handler_reference [protected]

Definition at line 67 of file InputDevice.h.

Scene* Engine::InputDevice::scene [protected]

Definition at line 65 of file InputDevice.h.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.