Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::Win32Input8 Class Reference

Utility class for dealing with user input on a Win32 system. More...

#include <OgreWin32Input8.h>

Inheritance diagram for Ogre::Win32Input8:

Ogre::InputReader List of all members.

Public Member Functions

 Win32Input8 ()
 ~Win32Input8 ()
virtual void initialise (RenderWindow *pWindow, bool useKeyboard=true, bool useMouse=true, bool useGameController=false)
 
Note:
Only keyboard and mouse currently implemented.
Parameters:
pWindow The window to capture input for
useKeyboard If true, keyboard input will be supported.
useMouse If true, mouse input will be supported.
useGameController If true, joysticks/gamepads will be supported.


virtual void capture ()
 
Remarks:
This method captures the state of all input devices and stores it internally for use when the enquiry methods are next called. This is done to ensure that all input is captured at once and therefore combinations of input are not subject to time differences when methods are called.


virtual long getMouseRelX () const
 Retrieves the relative (compared to the last input poll) mouse movement on the X (horizontal) axis.

virtual long getMouseRelY () const
 Retrieves the relative (compared to the last input poll) mouse movement on the Y (vertical) axis.

virtual long getMouseRelZ () const
 Retrieves the relative (compared to the last input poll) mouse movement on the Z (mouse wheel) axis.

virtual long getMouseAbsX () const
 Retrieves the absolute mouse position on the X (horizontal) axis.

virtual long getMouseAbsY () const
 Retrieves the absolute mouse position on the Y (vertical) axis.

virtual long getMouseAbsZ () const
 Retrieves the absolute mouse position on the Z (mouse wheel) axis.

virtual void getMouseState (MouseState &state) const
 Retrieves the current state of the mouse.

virtual bool getMouseButton (uchar button) const
 Retrieves the state of a mouse button.

void setBufferedInput (bool keys, bool mouse)
void flushAllBuffers ()
void useBufferedInput (EventQueue *pEventQueue, bool keys=true, bool mouse=true)
 Tells the reader to use buffered input and update the passed in queue.

virtual bool isKeyDown (KeyCode kc) const
 Determines if the specified key is currently depressed.

virtual long getMouseRelativeX () const
 Retrieves the relative position of the mouse when capture was called relative to the last time.

virtual long getMouseRelativeY () const
 Retrieves the relative position of the mouse when capture was called relative to the last time.

virtual long getMouseRelativeZ () const
 Retrieves the relative position of the mouse when capture was called relative to the last time.

void addCursorMoveListener (MouseMotionListener *c)
 Adds a mouse motion listener to the cursor object.

void removeCursorMoveListener (MouseMotionListener *c)
 Remove a mouse motion listener to the cursor object.

virtual void setMouseScale (Real scale)
 Set mouse scale factor.

virtual Real getMouseScale (void) const
 Get mouse scale factor.


Static Public Member Functions

char getKeyChar (int keyCode, long modifiers=0)

Protected Types

typedef std::set< KeyCodeBufferedKeysDownSet
 Set of all the keys currently depressed based on buffered input events.


Protected Member Functions

virtual bool isKeyDownImmediate (KeyCode kc) const
 
Note:
In immediate mode, this enquiry method uses the state of the keyboard at the last 'capture' call.


void mouseMoved ()
 Creates mouse moved or dragged events depending if any button is pressed.

void createMouseEvent (int id, int button)
 Creates a MouseEvent that first gets processed by the cursor, then gets pushed on the queue.

void triggerMouseButton (int nMouseCode, bool mousePressed)
 Creates mouse pressed, released, and clicked events.

void createKeyEvent (int id, int key)
void keyChanged (int key, bool down)

Protected Attributes

long mModifiers
 The modifiers are a binary flags that represent what buttons are pressed, and what key modifiers are down (e.g.

Real mMouseScale
 Speed of mouse.

CursormCursor
 Internal Cursor object.

EventQueuemEventQueue
 EventQueue is used for buffered input support.

bool mUseBufferedKeys
 Wether to use buffering input support - buffering support relies on using an EventQueue.

bool mUseBufferedMouse
 Wether to use buffering input support - buffering support relies on using an EventQueue.

MouseState mMouseState
 The mouse state in immediate mode.

BufferedKeysDownSet mBufferedKeysDown

Private Member Functions

void initialiseBufferedKeyboard ()
 specialised initialisation routines

void initialiseImmediateKeyboard ()
void initialiseBufferedMouse ()
void initialiseImmediateMouse ()
void captureKeyboard (void)
void captureMouse (void)
bool readBufferedKeyboardData ()
bool readBufferedMouseData ()
long getKeyModifiers () const
Real getScaled (DWORD dwVal) const

Private Attributes

IDirectInput8 * mlpDI
IDirectInputDevice8 * mlpDIKeyboard
IDirectInputDevice8 * mlpDIMouse
HWND mHWnd
long mMouseCenterX
long mMouseCenterY
long mMouseCenterZ
bool mUseKeyboard
bool mUseMouse
char mKeyboardBuffer [256]

Detailed Description

Utility class for dealing with user input on a Win32 system.

Note that this is a basic implementation only at the moment.

Definition at line 44 of file OgreWin32Input8.h.


Member Typedef Documentation

typedef std::set<KeyCode> Ogre::InputReader::BufferedKeysDownSet [protected, inherited]
 

Set of all the keys currently depressed based on buffered input events.

Definition at line 350 of file OgreInput.h.


Constructor & Destructor Documentation

Ogre::Win32Input8::Win32Input8  ) 
 

Ogre::Win32Input8::~Win32Input8  ) 
 


Member Function Documentation

void Ogre::InputReader::addCursorMoveListener MouseMotionListener c  )  [inherited]
 

Adds a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

virtual void Ogre::Win32Input8::capture  )  [virtual]
 

Remarks:
This method captures the state of all input devices and stores it internally for use when the enquiry methods are next called. This is done to ensure that all input is captured at once and therefore combinations of input are not subject to time differences when methods are called.

Implements Ogre::InputReader.

void Ogre::Win32Input8::captureKeyboard void   )  [private]
 

void Ogre::Win32Input8::captureMouse void   )  [private]
 

void Ogre::InputReader::createKeyEvent int  id,
int  key
[protected, inherited]
 

void Ogre::InputReader::createMouseEvent int  id,
int  button
[protected, inherited]
 

Creates a MouseEvent that first gets processed by the cursor, then gets pushed on the queue.

void Ogre::Win32Input8::flushAllBuffers  ) 
 

char Ogre::InputReader::getKeyChar int  keyCode,
long  modifiers = 0
[static, inherited]
 

long Ogre::Win32Input8::getKeyModifiers  )  const [private]
 

virtual long Ogre::Win32Input8::getMouseAbsX  )  const [virtual]
 

Retrieves the absolute mouse position on the X (horizontal) axis.

Implements Ogre::InputReader.

virtual long Ogre::Win32Input8::getMouseAbsY  )  const [virtual]
 

Retrieves the absolute mouse position on the Y (vertical) axis.

Implements Ogre::InputReader.

virtual long Ogre::Win32Input8::getMouseAbsZ  )  const [virtual]
 

Retrieves the absolute mouse position on the Z (mouse wheel) axis.

Implements Ogre::InputReader.

virtual bool Ogre::Win32Input8::getMouseButton uchar  button  )  const [virtual]
 

Retrieves the state of a mouse button.

Implements Ogre::InputReader.

virtual long Ogre::InputReader::getMouseRelativeX  )  const [virtual, inherited]
 

Retrieves the relative position of the mouse when capture was called relative to the last time.

Definition at line 266 of file OgreInput.h.

virtual long Ogre::InputReader::getMouseRelativeY  )  const [virtual, inherited]
 

Retrieves the relative position of the mouse when capture was called relative to the last time.

Definition at line 270 of file OgreInput.h.

virtual long Ogre::InputReader::getMouseRelativeZ  )  const [virtual, inherited]
 

Retrieves the relative position of the mouse when capture was called relative to the last time.

Definition at line 274 of file OgreInput.h.

virtual long Ogre::Win32Input8::getMouseRelX  )  const [virtual]
 

Retrieves the relative (compared to the last input poll) mouse movement on the X (horizontal) axis.

Implements Ogre::InputReader.

virtual long Ogre::Win32Input8::getMouseRelY  )  const [virtual]
 

Retrieves the relative (compared to the last input poll) mouse movement on the Y (vertical) axis.

Implements Ogre::InputReader.

virtual long Ogre::Win32Input8::getMouseRelZ  )  const [virtual]
 

Retrieves the relative (compared to the last input poll) mouse movement on the Z (mouse wheel) axis.

Implements Ogre::InputReader.

virtual Real Ogre::InputReader::getMouseScale void   )  const [virtual, inherited]
 

Get mouse scale factor.

Definition at line 317 of file OgreInput.h.

References Ogre::Real.

virtual void Ogre::Win32Input8::getMouseState MouseState state  )  const [virtual]
 

Retrieves the current state of the mouse.

Implements Ogre::InputReader.

Real Ogre::Win32Input8::getScaled DWORD  dwVal  )  const [private]
 

virtual void Ogre::Win32Input8::initialise RenderWindow pWindow,
bool  useKeyboard = true,
bool  useMouse = true,
bool  useGameController = false
[virtual]
 

Note:
Only keyboard and mouse currently implemented.
Parameters:
pWindow The window to capture input for
useKeyboard If true, keyboard input will be supported.
useMouse If true, mouse input will be supported.
useGameController If true, joysticks/gamepads will be supported.

Implements Ogre::InputReader.

void Ogre::Win32Input8::initialiseBufferedKeyboard  )  [private]
 

specialised initialisation routines

void Ogre::Win32Input8::initialiseBufferedMouse  )  [private]
 

void Ogre::Win32Input8::initialiseImmediateKeyboard  )  [private]
 

void Ogre::Win32Input8::initialiseImmediateMouse  )  [private]
 

virtual bool Ogre::InputReader::isKeyDown KeyCode  kc  )  const [virtual, inherited]
 

Determines if the specified key is currently depressed.

Note:
In immediate mode, this enquiry method uses the state of the keyboard at the last 'capture' call.

virtual bool Ogre::Win32Input8::isKeyDownImmediate KeyCode  kc  )  const [protected, virtual]
 

Note:
In immediate mode, this enquiry method uses the state of the keyboard at the last 'capture' call.

Implements Ogre::InputReader.

void Ogre::InputReader::keyChanged int  key,
bool  down
[protected, inherited]
 

void Ogre::InputReader::mouseMoved  )  [protected, inherited]
 

Creates mouse moved or dragged events depending if any button is pressed.

bool Ogre::Win32Input8::readBufferedKeyboardData  )  [private]
 

bool Ogre::Win32Input8::readBufferedMouseData  )  [private]
 

void Ogre::InputReader::removeCursorMoveListener MouseMotionListener c  )  [inherited]
 

Remove a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

void Ogre::Win32Input8::setBufferedInput bool  keys,
bool  mouse
[virtual]
 

Reimplemented from Ogre::InputReader.

virtual void Ogre::InputReader::setMouseScale Real  scale  )  [virtual, inherited]
 

Set mouse scale factor.

Parameters:
scale The new mouse scale (The default on is around 0.001/0.002).

Definition at line 313 of file OgreInput.h.

References Ogre::Real.

void Ogre::InputReader::triggerMouseButton int  nMouseCode,
bool  mousePressed
[protected, inherited]
 

Creates mouse pressed, released, and clicked events.

void Ogre::InputReader::useBufferedInput EventQueue pEventQueue,
bool  keys = true,
bool  mouse = true
[inherited]
 

Tells the reader to use buffered input and update the passed in queue.

Remarks:
The default behaviour of the input reader is simply to capture the current state of the mouse / keyboard on demand. An alternative is to use buffered input where all events are registered on a queue.


Member Data Documentation

BufferedKeysDownSet Ogre::InputReader::mBufferedKeysDown [protected, inherited]
 

Definition at line 351 of file OgreInput.h.

Cursor* Ogre::InputReader::mCursor [protected, inherited]
 

Internal Cursor object.

Remarks:
This is a mathematical representation of where the cursor is, it does not draw a cursor.
See also:
CursorGuiElement.

Definition at line 336 of file OgreInput.h.

EventQueue* Ogre::InputReader::mEventQueue [protected, inherited]
 

EventQueue is used for buffered input support.

Definition at line 339 of file OgreInput.h.

HWND Ogre::Win32Input8::mHWnd [private]
 

Definition at line 89 of file OgreWin32Input8.h.

char Ogre::Win32Input8::mKeyboardBuffer[256] [private]
 

Definition at line 118 of file OgreWin32Input8.h.

IDirectInput8* Ogre::Win32Input8::mlpDI [private]
 

Definition at line 85 of file OgreWin32Input8.h.

IDirectInputDevice8* Ogre::Win32Input8::mlpDIKeyboard [private]
 

Definition at line 86 of file OgreWin32Input8.h.

IDirectInputDevice8* Ogre::Win32Input8::mlpDIMouse [private]
 

Definition at line 87 of file OgreWin32Input8.h.

long Ogre::InputReader::mModifiers [protected, inherited]
 

The modifiers are a binary flags that represent what buttons are pressed, and what key modifiers are down (e.g.

shift/alt).

Definition at line 325 of file OgreInput.h.

long Ogre::Win32Input8::mMouseCenterX [private]
 

Definition at line 111 of file OgreWin32Input8.h.

long Ogre::Win32Input8::mMouseCenterY [private]
 

Definition at line 111 of file OgreWin32Input8.h.

long Ogre::Win32Input8::mMouseCenterZ [private]
 

Definition at line 111 of file OgreWin32Input8.h.

Real Ogre::InputReader::mMouseScale [protected, inherited]
 

Speed of mouse.

Definition at line 328 of file OgreInput.h.

MouseState Ogre::InputReader::mMouseState [protected, inherited]
 

The mouse state in immediate mode.

Definition at line 347 of file OgreInput.h.

bool Ogre::InputReader::mUseBufferedKeys [protected, inherited]
 

Wether to use buffering input support - buffering support relies on using an EventQueue.

See also:
class EventQueue

Definition at line 344 of file OgreInput.h.

bool Ogre::InputReader::mUseBufferedMouse [protected, inherited]
 

Wether to use buffering input support - buffering support relies on using an EventQueue.

See also:
class EventQueue

Definition at line 344 of file OgreInput.h.

bool Ogre::Win32Input8::mUseKeyboard [private]
 

Definition at line 112 of file OgreWin32Input8.h.

bool Ogre::Win32Input8::mUseMouse [private]
 

Definition at line 112 of file OgreWin32Input8.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:46:28 2006