MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 
bool 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::DirectionalMotionState
GetHorizontalWheelState () 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...
 
bool GetRelativeMode ()
 Gets whether or not relative mode is enabled. More...
 
const
Input::DirectionalMotionState
GetVerticalWheelState () 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 (bool Visible)
 Sets the visibility of the mouse cursor. More...
 
void SetMouseCursor ()
 Sets the mouse cursor.
 
bool SetRelativeMode (bool 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...
 
bool CheckButtonState (const UInt16 Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
bool 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...
 
bool IsButtonLifting (const UInt16 Button) const
 Gets whether or not a device button was lifted this frame. More...
 
bool IsButtonLifting (const Input::InputCode &Button) const
 Gets whether or not a device button was lifted this frame. More...
 
bool IsButtonPressed (const UInt16 Button) const
 Gets whether or not a device button is pressed down. More...
 
bool IsButtonPressed (const Input::InputCode &Button) const
 Gets whether or not a device button is pressed down. More...
 
bool IsButtonPressing (const UInt16 Button) const
 Gets whether or not a device button was pressed this frame. More...
 
bool IsButtonPressing (const Input::InputCode &Button) const
 Gets whether or not a device button was pressed this frame. More...
 
bool IsButtonTransitioning (const UInt16 Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
bool 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...
 
bool 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...
 
bool 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
 
Vector2 Delta
 
Input::DirectionalMotionState HorizontalWheelState
 
MetaCode MulticlickCode
 
StopWatchTimerMulticlickTimer
 
Vector2 Position
 
Input::DirectionalMotionState VerticalWheelState
 
- Protected Attributes inherited from Mezzanine::Input::ButtonDevice
std::vector< Input::ButtonStateButtons
 
std::vector< WholeTransitioningIndexes
 
- Protected Attributes inherited from Mezzanine::Input::Device
SequenceContainer Sequences
 

Detailed Description

This class represents the mouse input device.

Definition at line 63 of file mouse.h.

Member Function Documentation

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

Implements Mezzanine::Input::ButtonDevice.

Definition at line 184 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 198 of file mouse.cpp.

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

Implements Mezzanine::Input::ButtonDevice.

Definition at line 250 of file mouse.cpp.

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

Implements Mezzanine::Input::ButtonDevice.

Definition at line 253 of file mouse.cpp.

bool 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 268 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 241 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 244 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 247 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 259 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 214 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 217 of file mouse.cpp.

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

Gets the current mouse cursor.

Todo:
Implement this.

Definition at line 280 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 238 of file mouse.cpp.

bool 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 274 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 256 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 229 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 232 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 235 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 220 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 223 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 226 of file mouse.cpp.

bool 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 193 of file mouse.cpp.

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

Sets the visibility of the mouse cursor.

Parameters
VisibleWhether or not the cursor is to be visible.

Definition at line 265 of file mouse.cpp.

bool Mezzanine::Input::Mouse::SetRelativeMode ( bool  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 271 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 77 of file mouse.cpp.

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

Implements Mezzanine::Input::ButtonDevice.

Definition at line 175 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 286 of file mouse.cpp.


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