C# Class ThoNohT.NohBoard.Hooking.MouseState

A class representing the current state of the mouse. I.e. which buttons are pressed, what is the current location, movement and scroll state.
Exibir arquivo Open project: ThoNohT/NohBoard

Public Methods

Method Description
AddPressedElement ( MouseKeyCode keyCode ) : void

Adds the specified mouse keycode to the list of pressed keys.

AddScrollDirection ( MouseScrollKeyCode keyCode ) : void

Adds the specified scroll direction to the list of scroll keys. Resets its timer if it is already pressed.

CheckKeys ( ) : void

Checks the state of all keys and removes the ones that are no longer pressed from the list of pressed keys.

CheckScrollAndMovement ( ) : void

Checks the scroll keys and movement. Call this method to remove the scroll buttons from state after they have been added. Also adds zero movement items to the history to return the movement counter to 0 gradually.

RegisterLocation ( Point location, int time ) : void

Registers a new location for the mouse.

RemovePressedElement ( MouseKeyCode keyCode ) : void

Removes the specified keycode from the list of pressed keys.

SetMouseFromCenter ( bool activate ) : void

Sets a value indicating whether to calculate the mouse speed from the center or not.

This method also recalculates the screen centers. So if a screen is added or removed while NohBoard is running, calling this method with true will re-calculate the new screen locations.

Private Methods

Method Description
GetScreenCenterForPoint ( Point point ) : Point?

Gets the coordinates of the center of the screen that contains point.

The screen centers are pre-calculated whenever SetMouseFromCenter is set to true.

GetSpeed ( Point target, Point source, int dt ) : SizeF

Calculates the speed given two points and a time difference.

KeyIsUp ( MouseKeyCode key ) : bool

Checks whether the specified key is up.

Method Details

AddPressedElement() public static method

Adds the specified mouse keycode to the list of pressed keys.
public static AddPressedElement ( MouseKeyCode keyCode ) : void
keyCode MouseKeyCode The keycode to add.
return void

AddScrollDirection() public static method

Adds the specified scroll direction to the list of scroll keys. Resets its timer if it is already pressed.
public static AddScrollDirection ( MouseScrollKeyCode keyCode ) : void
keyCode MouseScrollKeyCode The keycode of the scroll direction.
return void

CheckKeys() public static method

Checks the state of all keys and removes the ones that are no longer pressed from the list of pressed keys.
public static CheckKeys ( ) : void
return void

CheckScrollAndMovement() public static method

Checks the scroll keys and movement. Call this method to remove the scroll buttons from state after they have been added. Also adds zero movement items to the history to return the movement counter to 0 gradually.
public static CheckScrollAndMovement ( ) : void
return void

RegisterLocation() public static method

Registers a new location for the mouse.
public static RegisterLocation ( Point location, int time ) : void
location Point The new location.
time int The time at which the location was registered.
return void

RemovePressedElement() public static method

Removes the specified keycode from the list of pressed keys.
public static RemovePressedElement ( MouseKeyCode keyCode ) : void
keyCode MouseKeyCode The keycode to remove.
return void

SetMouseFromCenter() public static method

Sets a value indicating whether to calculate the mouse speed from the center or not.
This method also recalculates the screen centers. So if a screen is added or removed while NohBoard is running, calling this method with true will re-calculate the new screen locations.
public static SetMouseFromCenter ( bool activate ) : void
activate bool True if distance should be caculated relative to the screen center, /// false if distance should be calculated relative to the previous mouse position.
return void