Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Input::Mouse Class Reference

This class represents the mouse input device. More...

#include <mouse.h>

+ Inheritance diagram for Mezzanine::Input::Mouse:
+ Collaboration diagram for Mezzanine::Input::Mouse:

Public Member Functions

 Mouse ()
 Class constructor.
 
virtual ~Mouse ()
 Class destructor.
 
const Input::ButtonStateGetButtonState (const UInt16 Button) const
 
const Input::ButtonStateGetButtonState (const Input::InputCode &Button) const
 
Boole GetCursorVisibility ()
 Gets the current state of the visibility of the cursor. More...
 
Real GetDeltaX () const
 Gets the X delta of the mouse position from the last update. More...
 
Real GetDeltaY () const
 Gets the Y delta of the mouse position from the last update. More...
 
UInt16 GetDeviceIndex () const
 Gets the device index of this controller. More...
 
const Input::DirectionalMotionStateGetHorizontalWheelState () const
 Gets the current state of the horizontal mouse wheel. More...
 
Graphics::ViewportGetHoveredViewport () const
 Gets a pointer to the current viewport the mouse cursor is hovered over. More...
 
Graphics::GameWindowGetHoveredWindow () const
 Gets a pointer to the window with the current mouse focus. More...
 
void GetMouseCursor ()
 Gets the current mouse cursor. More...
 
const Vector2GetMouseDelta () const
 Gets the change in the mouse position from the previous update. More...
 
Boole GetRelativeMode ()
 Gets whether or not relative mode is enabled. More...
 
const Input::DirectionalMotionStateGetVerticalWheelState () const
 Gets the current state of the vertical mouse wheel. More...
 
Vector2 GetViewportPosition () const
 Gets the position of the mouse cursor relative to the origin of the viewport in the window with the mouse focus. More...
 
Real GetViewportX () const
 Gets the X position of the mouse relative to the viewport. More...
 
Real GetViewportY () const
 Gets the Y position of the mouse relative to the viewport. More...
 
const Vector2GetWindowPosition () const
 Gets the position of the mouse cursor relative to the origin of the window with the mouse focus. More...
 
Real GetWindowX () const
 Gets the X position of the mouse relative to the window. More...
 
Real GetWindowY () const
 Gets the Y position of the mouse relative to the window. More...
 
void SetCursorVisibility (Boole Visible)
 Sets the visibility of the mouse cursor. More...
 
void SetMouseCursor ()
 Sets the mouse cursor.
 
Boole SetRelativeMode (Boole Enable)
 Sets whether or not relative mode is enabled. More...
 
void WarpCursorToPosition (Graphics::GameWindow *Win, const Vector2 &Position)
 Sets the mouse cursor's position to the specified point in the specified window. More...
 
- Public Member Functions inherited from Mezzanine::Input::ButtonDevice
 ButtonDevice ()
 Class constructor.
 
virtual ~ButtonDevice ()
 Class destructor.
 
void _Update (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)
 Updates this device with the newest data. More...
 
Boole CheckButtonState (const UInt16 Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
Boole CheckButtonState (const Input::InputCode &Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
UInt16 GetNumButtons () const
 Gets the number of buttons on this device. More...
 
Boole IsButtonLifting (const UInt16 Button) const
 Gets whether or not a device button was lifted this frame. More...
 
Boole IsButtonLifting (const Input::InputCode &Button) const
 Gets whether or not a device button was lifted this frame. More...
 
Boole IsButtonPressed (const UInt16 Button) const
 Gets whether or not a device button is pressed down. More...
 
Boole IsButtonPressed (const Input::InputCode &Button) const
 Gets whether or not a device button is pressed down. More...
 
Boole IsButtonPressing (const UInt16 Button) const
 Gets whether or not a device button was pressed this frame. More...
 
Boole IsButtonPressing (const Input::InputCode &Button) const
 Gets whether or not a device button was pressed this frame. More...
 
Boole IsButtonTransitioning (const UInt16 Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
Boole IsButtonTransitioning (const Input::ButtonState &Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
- Public Member Functions inherited from Mezzanine::Input::Device
 Device ()
 Class constructor.
 
virtual ~Device ()
 Class destructor.
 
void AddInputSequence (const MetaCodeContainer &Codes, const Int32 &SequenceID)
 Adds a custom sequence of inputs that this system will look for and generate MetaCode's for when they occur.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown. An exception can also be thrown if the ID provided is the max value of an Int32.
More...
 
Int32 GetIDofInputSequence (const MetaCodeContainer &Codes)
 Gets the ID of the provided sequence of MetaCode's.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 
Boole InputSequenceExists (const MetaCodeContainer &Codes)
 Checks to see if the provided sequence of MetaCode's is already being checked for.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 
void RemoveAllInputSequences ()
 Removes all stored input sequences. More...
 
void RemoveInputSequence (const MetaCodeContainer &Codes)
 Removes the specified custom sequence of MetaCode's.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 

Protected Member Functions

void AddPressedButtons (MetaCodeContainer &GeneratedCodes) const
 
Input::InputCode ConvertToMultiClickCode (const Input::InputCode Code) const
 Converts a standard mouse button code to the appropriate multiclick code for that button. More...
 
Boole IsMultiClickable (const Input::InputCode Code) const
 Checks to see if this code pertains to a button we can track multiple clicks for. More...
 
void UpdateImpl (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)
 
void VerifySequenceImpl (const MetaCodeContainer &Sequence) const
 
- Protected Member Functions inherited from Mezzanine::Input::ButtonDevice
void UpdateButtonTransitions ()
 Updates transitioning buttons. More...
 

Protected Attributes

Graphics::ViewportCurrentViewport
 The viewport that the mouse cursor is currently in. More...
 
Vector2 Delta
 The change in the mouse cursor position since the last update. More...
 
Input::DirectionalMotionState HorizontalWheelState
 The current state of the horizontal mouse wheel (if present). More...
 
MetaCode MulticlickCode
 A copy of the current MetaCode being tracked for multi-click detection. More...
 
TimerMulticlickTimer
 The timer used to detect multi-clicks. More...
 
Vector2 Position
 The current screen position of the mouse cursor. More...
 
Input::DirectionalMotionState VerticalWheelState
 The current state of the vertical mouse wheel (if present). More...
 
- Protected Attributes inherited from Mezzanine::Input::ButtonDevice
std::vector< Input::ButtonStateButtons
 A container of states for each button on the input device. More...
 
std::vector< WholeTransitioningIndexes
 A container of indexes being tracked due to state transitions. More...
 
- Protected Attributes inherited from Mezzanine::Input::Device
SequenceContainer Sequences
 A container for storing and detecting input sequences for an input device. More...
 

Detailed Description

This class represents the mouse input device.

Definition at line 60 of file mouse.h.

Member Function Documentation

void Mezzanine::Input::Mouse::AddPressedButtons ( MetaCodeContainer GeneratedCodes) const
protectedvirtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 171 of file mouse.cpp.

Input::InputCode Mezzanine::Input::Mouse::ConvertToMultiClickCode ( const Input::InputCode  Code) const
protected

Converts a standard mouse button code to the appropriate multiclick code for that button.

Definition at line 185 of file mouse.cpp.

const Input::ButtonState & Mezzanine::Input::Mouse::GetButtonState ( const UInt16  Button) const
virtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 237 of file mouse.cpp.

const Input::ButtonState & Mezzanine::Input::Mouse::GetButtonState ( const Input::InputCode Button) const
virtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 240 of file mouse.cpp.

Boole Mezzanine::Input::Mouse::GetCursorVisibility ( )

Gets the current state of the visibility of the cursor.

Returns
Returns true if the cursor is visible, false otherwise.

Definition at line 255 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetDeltaX ( ) const

Gets the X delta of the mouse position from the last update.

Returns
Returns a real with the offset from the previous update on the X axis.

Definition at line 228 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetDeltaY ( ) const

Gets the Y delta of the mouse position from the last update.

Returns
Returns a real with the offset from the previous update on the Y axis.

Definition at line 231 of file mouse.cpp.

UInt16 Mezzanine::Input::Mouse::GetDeviceIndex ( ) const
virtual

Gets the device index of this controller.

Returns
Returns a UInt16 representing the device index for this controller.

Implements Mezzanine::Input::Device.

Definition at line 234 of file mouse.cpp.

const Input::DirectionalMotionState & Mezzanine::Input::Mouse::GetHorizontalWheelState ( ) const

Gets the current state of the horizontal mouse wheel.

Remarks
If a mouse doesn't have a mouse wheel this will always report "DIRECTIONALMOTION_UNCHANGED".
Returns
Returns a directional motion update of the mouse wheel.

Definition at line 246 of file mouse.cpp.

Graphics::Viewport * Mezzanine::Input::Mouse::GetHoveredViewport ( ) const

Gets a pointer to the current viewport the mouse cursor is hovered over.

Returns
Returns a pointer to the hovered viewport.

Definition at line 201 of file mouse.cpp.

Graphics::GameWindow * Mezzanine::Input::Mouse::GetHoveredWindow ( ) const

Gets a pointer to the window with the current mouse focus.

Returns
Returns a pointer to the window with the current focus.

Definition at line 204 of file mouse.cpp.

void Mezzanine::Input::Mouse::GetMouseCursor ( )

Gets the current mouse cursor.

Todo:
Implement this.

Definition at line 267 of file mouse.cpp.

const Vector2 & Mezzanine::Input::Mouse::GetMouseDelta ( ) const

Gets the change in the mouse position from the previous update.

Returns
Returns a const reference to the change in the mouse position.

Definition at line 225 of file mouse.cpp.

Boole Mezzanine::Input::Mouse::GetRelativeMode ( )

Gets whether or not relative mode is enabled.

Returns
Returns true if relative mode is enabled, false otherwise.

Definition at line 261 of file mouse.cpp.

const Input::DirectionalMotionState & Mezzanine::Input::Mouse::GetVerticalWheelState ( ) const

Gets the current state of the vertical mouse wheel.

Remarks
If a mouse doesn't have a mouse wheel this will always report "DIRECTIONALMOTION_UNCHANGED".
Returns
Returns a directional motion update of the mouse wheel.

Definition at line 243 of file mouse.cpp.

Vector2 Mezzanine::Input::Mouse::GetViewportPosition ( ) const

Gets the position of the mouse cursor relative to the origin of the viewport in the window with the mouse focus.

Returns
Returns a vector2 to the mouse's current position on the current viewport.

Definition at line 216 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetViewportX ( ) const

Gets the X position of the mouse relative to the viewport.

Returns
Returns a real with the current viewport position on the X axis.

Definition at line 219 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetViewportY ( ) const

Gets the Y position of the mouse relative to the viewport.

Returns
Returns a real with the current viewport position on the Y axis.

Definition at line 222 of file mouse.cpp.

const Vector2 & Mezzanine::Input::Mouse::GetWindowPosition ( ) const

Gets the position of the mouse cursor relative to the origin of the window with the mouse focus.

Returns
Returns a const reference to the mouse's current position on the window.

Definition at line 207 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetWindowX ( ) const

Gets the X position of the mouse relative to the window.

Returns
Returns a real with the current window position on the X axis.

Definition at line 210 of file mouse.cpp.

Real Mezzanine::Input::Mouse::GetWindowY ( ) const

Gets the Y position of the mouse relative to the window.

Returns
Returns a real with the current window position on the Y axis.

Definition at line 213 of file mouse.cpp.

Boole Mezzanine::Input::Mouse::IsMultiClickable ( const Input::InputCode  Code) const
protected

Checks to see if this code pertains to a button we can track multiple clicks for.

Definition at line 180 of file mouse.cpp.

void Mezzanine::Input::Mouse::SetCursorVisibility ( Boole  Visible)

Sets the visibility of the mouse cursor.

Parameters
VisibleWhether or not the cursor is to be visible.

Definition at line 252 of file mouse.cpp.

Boole Mezzanine::Input::Mouse::SetRelativeMode ( Boole  Enable)

Sets whether or not relative mode is enabled.

Returns
Returns false if relative mode is not supported on this system. True if the operation was a success.
Remarks
"Relative mode" entails hiding the cursor, locking the position, and only updating the mouse delta position each update. This is useful for First Person Shooter style games.
Parameters
EnableTrue to enable relative mode, false to disable.

Definition at line 258 of file mouse.cpp.

void Mezzanine::Input::Mouse::UpdateImpl ( const MetaCodeContainer DeltaCodes,
MetaCodeContainer GeneratedCodes 
)
protectedvirtual

Todo:
Getting the mouse focus doesn't do what I originally thought it would. When a mouse leaves a window, the focus isn't set to NULL as expected. If you have only one window, then it just stays pointing to that window. If you have two then it will stay on the first window until you mouse over the second, even if there is a space between the windows. This should be updated somehow so that we can set "HoveredWindow" to NULL when none of our windows are being hovered.
Todo:
This code isn't as graceful as I am sure it can be made.

Implements Mezzanine::Input::ButtonDevice.

Definition at line 76 of file mouse.cpp.

void Mezzanine::Input::Mouse::VerifySequenceImpl ( const MetaCodeContainer Sequence) const
protectedvirtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 162 of file mouse.cpp.

void Mezzanine::Input::Mouse::WarpCursorToPosition ( Graphics::GameWindow Win,
const Vector2 Position 
)

Sets the mouse cursor's position to the specified point in the specified window.

Parameters
WinThe window to warp the cursor to.
PositionThe position on the specified window to warp the cursor to.
Todo:
Implement this.

Definition at line 273 of file mouse.cpp.

Member Data Documentation

Graphics::Viewport* Mezzanine::Input::Mouse::CurrentViewport
protected

The viewport that the mouse cursor is currently in.

Definition at line 74 of file mouse.h.

Vector2 Mezzanine::Input::Mouse::Delta
protected

The change in the mouse cursor position since the last update.

Definition at line 71 of file mouse.h.

Input::DirectionalMotionState Mezzanine::Input::Mouse::HorizontalWheelState
protected

The current state of the horizontal mouse wheel (if present).

Definition at line 80 of file mouse.h.

MetaCode Mezzanine::Input::Mouse::MulticlickCode
protected

A copy of the current MetaCode being tracked for multi-click detection.

Definition at line 65 of file mouse.h.

Timer* Mezzanine::Input::Mouse::MulticlickTimer
protected

The timer used to detect multi-clicks.

Definition at line 77 of file mouse.h.

Vector2 Mezzanine::Input::Mouse::Position
protected

The current screen position of the mouse cursor.

Definition at line 68 of file mouse.h.

Input::DirectionalMotionState Mezzanine::Input::Mouse::VerticalWheelState
protected

The current state of the vertical mouse wheel (if present).

Definition at line 83 of file mouse.h.


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