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

Ogre::Win32Input Class Reference

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

#include <OgreWin32Input.h>

Inheritance diagram for Ogre::Win32Input:

Ogre::InputReader List of all members.

Public Methods

 Win32Input ()
 ~Win32Input ()
void initialise (RenderWindow *pWindow, bool useKeyboard=true, bool useMouse=true, bool useGameController=false)
 Initialise the input system. More...

void capture (void)
 Captures the state of all the input devices. More...

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

int getMouseRelativeX (void)
 Retrieves the relative position of the mouse when capture was called relative to the last time. More...

int getMouseRelativeY (void)
 Retrieves the relative position of the mouse when capture was called relative to the last time. More...

void useBufferedInput (EventQueue *pEventQueue)
 Tells the reader to use buffered input and update the passed in queue. More...

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Protected Methods

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

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

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


Protected Attributes

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

CursormCursor
 Internal Cursor object. More...

EventQueuemEventQueue
 EventQueue is used for buffered input support. More...

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

MouseState mMouseState
 The mouse state in immediate mode. More...


Private Attributes

LPDIRECTINPUT7 mlpDI
LPDIRECTINPUTDEVICE7 mlpDIKeyboard
LPDIRECTINPUTDEVICE7 mlpDIMouse
HWND mHWnd
char mKeyboardBuffer [256]
int mMouseX
int mMouseY
int mMouseCenterX
int mMouseCenterY
bool mLMBDown
bool mRMBDown

Detailed Description

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

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


Constructor & Destructor Documentation

Ogre::Win32Input::Win32Input  
 

Ogre::Win32Input::~Win32Input  
 


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.

void Ogre::Win32Input::capture void    [virtual]
 

Captures the state of all the input devices.

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::InputReader::createMouseEvent int    id,
int    button
[protected, inherited]
 

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

virtual long Ogre::InputReader::getMouseAbsX   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual long Ogre::InputReader::getMouseAbsY   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual long Ogre::InputReader::getMouseAbsZ   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual bool Ogre::InputReader::getMouseButton uchar    button const [pure virtual, inherited]
 

Retrieves the state of a mouse button.

Implemented in Ogre::SDLInput.

virtual long Ogre::InputReader::getMouseRelativeX void    const [inline, virtual, inherited]
 

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

Reimplemented in Ogre::Win32Input.

int Ogre::Win32Input::getMouseRelativeX void    [virtual]
 

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

Reimplemented from Ogre::InputReader.

virtual long Ogre::InputReader::getMouseRelativeY void    const [inline, virtual, inherited]
 

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

Reimplemented in Ogre::Win32Input.

int Ogre::Win32Input::getMouseRelativeY void    [virtual]
 

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

Reimplemented from Ogre::InputReader.

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

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

virtual long Ogre::InputReader::getMouseRelX   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual long Ogre::InputReader::getMouseRelY   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual long Ogre::InputReader::getMouseRelZ   const [pure virtual, inherited]
 

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

Implemented in Ogre::SDLInput.

virtual void Ogre::InputReader::getMouseState MouseState   state const [pure virtual, inherited]
 

Retrieves the current state of the mouse.

Implemented in Ogre::SDLInput.

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

Initialise the input system.

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.

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

Determines if the specified key is currently depressed.

Note:
This enquiry method uses the state of the keyboard at the last 'capture' call.

Implemented in Ogre::SDLInput.

bool Ogre::Win32Input::isKeyDown KeyCode    kc
 

Determines if the specified key is currently depressed.

Note that this enquiry method uses the state of the keyboard at the last 'capture' call.

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

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

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

Remove a mouse motion listener to the cursor object.

This keeps the Cursor object hidden.

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

Creates mouse pressed, released, and clicked events.

void Ogre::InputReader::useBufferedInput EventQueue   pEventQueue [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

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.

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

EventQueue is used for buffered input support.

HWND Ogre::Win32Input::mHWnd [private]
 

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

bool Ogre::Win32Input::mLMBDown [private]
 

LPDIRECTINPUT7 Ogre::Win32Input::mlpDI [private]
 

LPDIRECTINPUTDEVICE7 Ogre::Win32Input::mlpDIKeyboard [private]
 

LPDIRECTINPUTDEVICE7 Ogre::Win32Input::mlpDIMouse [private]
 

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).

int Ogre::Win32Input::mMouseCenterX [private]
 

int Ogre::Win32Input::mMouseCenterY [private]
 

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

The mouse state in immediate mode.

int Ogre::Win32Input::mMouseX [private]
 

int Ogre::Win32Input::mMouseY [private]
 

bool Ogre::Win32Input::mRMBDown [private]
 

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

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

See also:
class EventQueue

Copyright © 2002 by The OGRE Team