C#Code
C#Code
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
Libraries.Messaging.MouseInputMessageHandler Class Reference
Inheritance diagram for Libraries.Messaging.MouseInputMessageHandler:
Libraries.Messaging.BaseMessageHandler Libraries.Messaging.BaseMessageHandler Libraries.BaseObject Libraries.BaseObject

List of all members.

Public Types

enum  MouseButton {
  LEFT_BUTTON = 0, MIDDLE_BUTTON, RIGHT_BUTTON, MOUSE_MOVE,
  MOUSE_POS, NONE, LEFT_BUTTON = 0, MIDDLE_BUTTON,
  RIGHT_BUTTON, MOUSE_MOVE, MOUSE_POS, NONE
}
enum  MouseButtonState {
  PRESSED = 0, HELD, RELEASED, DOUBLE_CLICKED,
  NONE, PRESSED = 0, HELD, RELEASED,
  DOUBLE_CLICKED, NONE
}
enum  MouseMovement {
  SCREEN_POS = 0, SCREEN_OFFSET, NONE, SCREEN_POS = 0,
  SCREEN_OFFSET, NONE
}
enum  MouseMovementState { MOVED = 0, NONE, MOVED = 0, NONE }
enum  MouseButton {
  LEFT_BUTTON = 0, MIDDLE_BUTTON, RIGHT_BUTTON, MOUSE_MOVE,
  MOUSE_POS, NONE, LEFT_BUTTON = 0, MIDDLE_BUTTON,
  RIGHT_BUTTON, MOUSE_MOVE, MOUSE_POS, NONE
}
enum  MouseButtonState {
  PRESSED = 0, HELD, RELEASED, DOUBLE_CLICKED,
  NONE, PRESSED = 0, HELD, RELEASED,
  DOUBLE_CLICKED, NONE
}
enum  MouseMovement {
  SCREEN_POS = 0, SCREEN_OFFSET, NONE, SCREEN_POS = 0,
  SCREEN_OFFSET, NONE
}
enum  MouseMovementState { MOVED = 0, NONE, MOVED = 0, NONE }

Public Member Functions

 MouseInputMessageHandler ()
void SetIgnoreButtons (bool ignoreButtons)
void SetIgnoreMovement (bool ignoreMovement)
bool GetIgnoreButtons ()
void AddButtonStateCheck (MouseButton button, MouseButtonState state)
void AddMovementStateCheck (MouseMovement movement, MouseMovementState state)
void AddButtonStateCheck (MouseButton button, bool onPress, bool onRelease, bool onHeld, bool onNone)
void RemoveButtonStateCheck (MouseButton button, MouseButtonState state)
void RemoveMovementStateCheck (MouseMovement movement, MouseMovementState state)
void RemoveButtonStateChecks (MouseButton button)
void RemoveMovementStateChecks (MouseMovement movement)
void RemoveAllChecks ()
void RemoveButtonChecks ()
void RemoveMovementChecks ()
override void Update (int timePassed)
MouseButtonState GetButtonState (MouseInputMessageHandler.MouseButton button)
 MouseInputMessageHandler ()
void AddButtonStateCheck (MouseButton button, MouseButtonState state)
void AddMovementStateCheck (MouseMovement movement, MouseMovementState state)
void AddButtonStateCheck (MouseButton button, bool onPress, bool onRelease, bool onHeld, bool onNone)
void RemoveButtonStateCheck (MouseButton button, MouseButtonState state)
void RemoveMovementStateCheck (MouseMovement movement, MouseMovementState state)
void RemoveButtonStateChecks (MouseButton button)
void RemoveMovementStateChecks (MouseMovement movement)
void RemoveAllChecks ()
void RemoveButtonChecks ()
void RemoveMovementChecks ()
override void Update (int timePassed)

Protected Member Functions

void UpdateButtonInput (int frames, MouseState mouseData)
void UpdateMovementInput (int timePassed, MouseState mouseData)
void UpdateButtonInput (int frames, MouseState mouseData)
void UpdateMovementInput (int timePassed, MouseState mouseData)

Protected Attributes

List< MouseButtonMessagem_buttonChecks
 Button states to check for.
List< MouseButtonMessagem_buttonStates
 Last known state (HELD or NONE) for each button being checked.
List< MouseMovementMessagem_movementChecks
 Movement states to check for.
List< MouseMovementMessagem_movementStates
 Last known state for each movement being checked.
Microsoft.Xna.Framework.Point m_mousePosSend
bool m_storeMousePos

Private Member Functions

MouseButtonState GetMouseXNAButtonState (MouseButton button)
MouseButtonState ConvertMouseXNAState (ButtonState state)
void RemoveButtonCurrentState (MouseInputMessageHandler.MouseButton button)
void RemoveMovementCurrentState (MouseInputMessageHandler.MouseMovement movement)
int FindButtonEvent (MouseButton button, MouseButtonState state)
int FindMovementEvent (MouseMovement movement, MouseMovementState state)
int FindButtonState (MouseInputMessageHandler.MouseButton button)
int FindMovementState (MouseInputMessageHandler.MouseMovement movement)
MouseButtonState GetMouseXNAButtonState (MouseButton button)
MouseButtonState ConvertMouseXNAState (ButtonState state)
void RemoveButtonCurrentState (MouseInputMessageHandler.MouseButton button)
void RemoveMovementCurrentState (MouseInputMessageHandler.MouseMovement movement)
int FindButtonEvent (MouseButton button, MouseButtonState state)
int FindMovementEvent (MouseMovement movement, MouseMovementState state)
int FindButtonState (MouseInputMessageHandler.MouseButton button)
int FindMovementState (MouseInputMessageHandler.MouseMovement movement)

Private Attributes

bool m_ignoreButtons
 True if input buttons should be ignored, false if not.
bool m_ignoreMovement
 True if input movement should be ignored, false if not.

Detailed Description

Message handler for input events. Checks for input and creates messages that the input occured. Input should never be directly checked by anything else. Anybody that needs to know about input can check the handler.


Member Enumeration Documentation

Represents a mouse button.

Enumerator:
LEFT_BUTTON 
MIDDLE_BUTTON 
RIGHT_BUTTON 
MOUSE_MOVE 
MOUSE_POS 

Mouse moved, this is the offset from the last position.

NONE 

Mouse moved, this is the screen position.

No button (default). Must be last in the list. Add all other enums before this.

LEFT_BUTTON 
MIDDLE_BUTTON 
RIGHT_BUTTON 
MOUSE_MOVE 
MOUSE_POS 

Mouse moved, this is the offset from the last position.

NONE 

Mouse moved, this is the screen position.

No button (default). Must be last in the list. Add all other enums before this.

Represents a mouse button.

Enumerator:
LEFT_BUTTON 
MIDDLE_BUTTON 
RIGHT_BUTTON 
MOUSE_MOVE 
MOUSE_POS 

Mouse moved, this is the offset from the last position.

NONE 

Mouse moved, this is the screen position.

No button (default). Must be last in the list. Add all other enums before this.

LEFT_BUTTON 
MIDDLE_BUTTON 
RIGHT_BUTTON 
MOUSE_MOVE 
MOUSE_POS 

Mouse moved, this is the offset from the last position.

NONE 

Mouse moved, this is the screen position.

No button (default). Must be last in the list. Add all other enums before this.

Represents a mouse button state.

Enumerator:
PRESSED 
HELD 

Button was pressed.

RELEASED 

Button is held.

DOUBLE_CLICKED 

Button is released.

NONE 

Button was double clicked.

Button is up (default state). Must be last in the list. Add other enums before this.

PRESSED 
HELD 

Button was pressed.

RELEASED 

Button is held.

DOUBLE_CLICKED 

Button is released.

NONE 

Button was double clicked.

Button is up (default state). Must be last in the list. Add other enums before this.

Represents a mouse button state.

Enumerator:
PRESSED 
HELD 

Button was pressed.

RELEASED 

Button is held.

DOUBLE_CLICKED 

Button is released.

NONE 

Button was double clicked.

Button is up (default state). Must be last in the list. Add other enums before this.

PRESSED 
HELD 

Button was pressed.

RELEASED 

Button is held.

DOUBLE_CLICKED 

Button is released.

NONE 

Button was double clicked.

Button is up (default state). Must be last in the list. Add other enums before this.

Represents a mouse movement types, like if it is the screen position or offset from the last known position.

Enumerator:
SCREEN_POS 
SCREEN_OFFSET 

Checks mouse movement in terms of screen position.

NONE 

Checks mouse movement in terms of screen offset from the previous location.

No type (default state). Must be last in the list. Add other enums before this.

SCREEN_POS 
SCREEN_OFFSET 

Checks mouse movement in terms of screen position.

NONE 

Checks mouse movement in terms of screen offset from the previous location.

No type (default state). Must be last in the list. Add other enums before this.

Represents a mouse movement types, like if it is the screen position or offset from the last known position.

Enumerator:
SCREEN_POS 
SCREEN_OFFSET 

Checks mouse movement in terms of screen position.

NONE 

Checks mouse movement in terms of screen offset from the previous location.

No type (default state). Must be last in the list. Add other enums before this.

SCREEN_POS 
SCREEN_OFFSET 

Checks mouse movement in terms of screen position.

NONE 

Checks mouse movement in terms of screen offset from the previous location.

No type (default state). Must be last in the list. Add other enums before this.

Represents a mouse movement state.

Enumerator:
MOVED 
NONE 

Mouse moved.

Mouse didn't move (default state). Must be last in the list. Add other enums before this.

MOVED 
NONE 

Mouse moved.

Mouse didn't move (default state). Must be last in the list. Add other enums before this.

Represents a mouse movement state.

Enumerator:
MOVED 
NONE 

Mouse moved.

Mouse didn't move (default state). Must be last in the list. Add other enums before this.

MOVED 
NONE 

Mouse moved.

Mouse didn't move (default state). Must be last in the list. Add other enums before this.


Constructor & Destructor Documentation

Libraries.Messaging.MouseInputMessageHandler.MouseInputMessageHandler ( )

Default constructor.

Libraries.Messaging.MouseInputMessageHandler.MouseInputMessageHandler ( )

Default constructor.


Member Function Documentation

void Libraries.Messaging.MouseInputMessageHandler.AddButtonStateCheck ( MouseButton  button,
MouseButtonState  state 
)

Add a check for the given button and the corresponding state. If a check already exists then nothing happens.

button - Button to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.AddButtonStateCheck ( MouseButton  button,
bool  onPress,
bool  onRelease,
bool  onHeld,
bool  onNone 
)

Add a check for the given button and the corresponding states. It a check already exists then nothing happens. This is for convenience so you can set all the states at one. This does not remove states if you pass fall for anything.

button - Button to check for.
onPress - True if it should check for the on press event, false if not.
onRelease - True if it should check for the on release event, false if not.
onHeld - True if it should check for the button being held event, false if not.
onNone - True if a message should occur if the button is not held or pressed.
void Libraries.Messaging.MouseInputMessageHandler.AddButtonStateCheck ( MouseButton  button,
MouseButtonState  state 
)

Add a check for the given button and the corresponding state. If a check already exists then nothing happens.

button - Button to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.AddButtonStateCheck ( MouseButton  button,
bool  onPress,
bool  onRelease,
bool  onHeld,
bool  onNone 
)

Add a check for the given button and the corresponding states. It a check already exists then nothing happens. This is for convenience so you can set all the states at one. This does not remove states if you pass fall for anything.

button - Button to check for.
onPress - True if it should check for the on press event, false if not.
onRelease - True if it should check for the on release event, false if not.
onHeld - True if it should check for the button being held event, false if not.
onNone - True if a message should occur if the button is not held or pressed.
void Libraries.Messaging.MouseInputMessageHandler.AddMovementStateCheck ( MouseMovement  movement,
MouseMovementState  state 
)

Add a check for the given movement and the corresponding state. If a check already exists then nothing happens.

movement - Movement to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.AddMovementStateCheck ( MouseMovement  movement,
MouseMovementState  state 
)

Add a check for the given movement and the corresponding state. If a check already exists then nothing happens.

movement - Movement to check for.
state - State to check for.
MouseButtonState Libraries.Messaging.MouseInputMessageHandler.ConvertMouseXNAState ( ButtonState  state) [private]

Convert the xna button state to the input manager type.

state - State to convert.
MouseButtonState Libraries.Messaging.MouseInputMessageHandler.ConvertMouseXNAState ( ButtonState  state) [private]

Convert the xna button state to the input manager type.

state - State to convert.
int Libraries.Messaging.MouseInputMessageHandler.FindButtonEvent ( MouseButton  button,
MouseButtonState  state 
) [private]

Searchs the list of button events to check for and finds where the given event is located.

button - Button to check for.
state - State to check for.
Return: Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindButtonEvent ( MouseButton  button,
MouseButtonState  state 
) [private]

Searchs the list of button events to check for and finds where the given event is located.

button - Button to check for.
state - State to check for.
Return: Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindButtonState ( MouseInputMessageHandler.MouseButton  button) [private]

Searchs the list of button events to check for and finds where the given button state is located.

button - Button to check for.
Return: Value is the index in the list the matching state is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindButtonState ( MouseInputMessageHandler.MouseButton  button) [private]

Searchs the list of button events to check for and finds where the given button state is located.

button - Button to check for.
Return: Value is the index in the list the matching state is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindMovementEvent ( MouseMovement  movement,
MouseMovementState  state 
) [private]

Searchs the list of movement events to check for and finds where the given event is located.

movement - Movement to check for.
state - State to check for.
Return: Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindMovementEvent ( MouseMovement  movement,
MouseMovementState  state 
) [private]

Searchs the list of movement events to check for and finds where the given event is located.

movement - Movement to check for.
state - State to check for.
Return: Value is the index in the list the matching event is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindMovementState ( MouseInputMessageHandler.MouseMovement  movement) [private]

Searchs the list of movement events to check for and finds where the given movement state is located.

movement - Movement to check for.
Return: Value is the index in the list the matching state is at. It is -1 if not found.
int Libraries.Messaging.MouseInputMessageHandler.FindMovementState ( MouseInputMessageHandler.MouseMovement  movement) [private]

Searchs the list of movement events to check for and finds where the given movement state is located.

movement - Movement to check for.
Return: Value is the index in the list the matching state is at. It is -1 if not found.
MouseButtonState Libraries.Messaging.MouseInputMessageHandler.GetButtonState ( MouseInputMessageHandler.MouseButton  button)

Retrive the current state of the given button, if tracked.

button - Button to check for.
Return: Value the button state if the button is tracked, MouseButtonState.NONE if the button isn't tracked or doesn't have a state.
bool Libraries.Messaging.MouseInputMessageHandler.GetIgnoreButtons ( )

Get weither buttons should be ignored.

Return:
Value is true if buttons should be ignored, false if not.

MouseButtonState Libraries.Messaging.MouseInputMessageHandler.GetMouseXNAButtonState ( MouseButton  button) [private]

Get which state the hardware mouse button is currently at. This is used because the mouse buttons are all there own objects in the mouse data from xna, and this is a easier way to check. Only used for buttons.

button - Button to check for.
MouseButtonState Libraries.Messaging.MouseInputMessageHandler.GetMouseXNAButtonState ( MouseButton  button) [private]

Get which state the hardware mouse button is currently at. This is used because the mouse buttons are all there own objects in the mouse data from xna, and this is a easier way to check. Only used for buttons.

button - Button to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveAllChecks ( )

Remove input checks and states.

button - Button to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveAllChecks ( )

Remove input checks and states.

button - Button to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonChecks ( )

Remove button checks and states.

void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonChecks ( )

Remove button checks and states.

void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonCurrentState ( MouseInputMessageHandler.MouseButton  button) [private]

Removes the stored current state for the given button. Use when all events for the button are removed.

button - Button whose state we no longer need to store.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonCurrentState ( MouseInputMessageHandler.MouseButton  button) [private]

Removes the stored current state for the given button. Use when all events for the button are removed.

button - Button whose state we no longer need to store.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonStateCheck ( MouseButton  button,
MouseButtonState  state 
)

Remove a check for the given button and the corresponding state.

button - Button to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonStateCheck ( MouseButton  button,
MouseButtonState  state 
)

Remove a check for the given button and the corresponding state.

button - Button to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonStateChecks ( MouseButton  button)

Remove all checks for the given button.

button - Button to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveButtonStateChecks ( MouseButton  button)

Remove all checks for the given button.

button - Button to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementChecks ( )

Remove movement checks and states.

void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementChecks ( )

Remove movement checks and states.

void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementCurrentState ( MouseInputMessageHandler.MouseMovement  movement) [private]

Removes the stored current state for the given movement. Use when all events for the movement are removed.

button - Button whose state we no longer need to store.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementCurrentState ( MouseInputMessageHandler.MouseMovement  movement) [private]

Removes the stored current state for the given movement. Use when all events for the movement are removed.

button - Button whose state we no longer need to store.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementStateCheck ( MouseMovement  movement,
MouseMovementState  state 
)

Remove a check for the given movement and the corresponding state.

movement - Movement to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementStateCheck ( MouseMovement  movement,
MouseMovementState  state 
)

Remove a check for the given movement and the corresponding state.

movement - Movement to check for.
state - State to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementStateChecks ( MouseMovement  movement)

Remove all checks for the given movement.

movement - Movement to check for.
void Libraries.Messaging.MouseInputMessageHandler.RemoveMovementStateChecks ( MouseMovement  movement)

Remove all checks for the given movement.

movement - Movement to check for.
void Libraries.Messaging.MouseInputMessageHandler.SetIgnoreButtons ( bool  ignoreButtons)

Set whether button input should be ignored.

ignoreButtons - True if button presses should be ignored, false if not.
void Libraries.Messaging.MouseInputMessageHandler.SetIgnoreMovement ( bool  ignoreMovement)

Set whether movement input should be ignored.

ignoreMovement - True if movement should be ignored, false if not.
override void Libraries.Messaging.MouseInputMessageHandler.Update ( int  timePassed) [virtual]

Check for button and movement events.

timePassed - How long the update is for. Value is in milliseconds.

Reimplemented from Libraries.Messaging.BaseMessageHandler.

override void Libraries.Messaging.MouseInputMessageHandler.Update ( int  timePassed) [virtual]

Check for button and movement events.

timePassed - How long the update is for. Value is in milliseconds.

Reimplemented from Libraries.Messaging.BaseMessageHandler.

void Libraries.Messaging.MouseInputMessageHandler.UpdateButtonInput ( int  frames,
MouseState  mouseData 
) [protected]

Check for button events.

button - Button to check for.
mouseData - Mouse data to check.
void Libraries.Messaging.MouseInputMessageHandler.UpdateButtonInput ( int  frames,
MouseState  mouseData 
) [protected]

Check for button events.

button - Button to check for.
mouseData - Mouse data to check.
void Libraries.Messaging.MouseInputMessageHandler.UpdateMovementInput ( int  timePassed,
MouseState  mouseData 
) [protected]

Check for movement events.

timePassed - Time passed to use.
mouseData - Mouse data to check.
void Libraries.Messaging.MouseInputMessageHandler.UpdateMovementInput ( int  timePassed,
MouseState  mouseData 
) [protected]

Check for movement events.

timePassed - Time passed to use.
mouseData - Mouse data to check.

Member Data Documentation

Button states to check for.

Last known state (HELD or NONE) for each button being checked.

True if input buttons should be ignored, false if not.

True if input movement should be ignored, false if not.

Microsoft Xna Framework Point Libraries::Messaging.MouseInputMessageHandler::m_mousePosSend [protected]

Holds the last stored mouse position. This will be the last checked actual mouse position if the handler is set to store directly from input. If not, then it will be whatever it was last told it was.

Movement states to check for.

Last known state for each movement being checked.

Whether the mouse position should be stored when mouse movement is detected. Stored mouse position is what is sent with a click message. So if you don't want direct from the mouse moving positions sent, set this to false.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Properties