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.
Afficher le fichier Open project: ThoNohT/NohBoard

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

AddScrollDirection() public static méthode

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.
Résultat void

CheckKeys() public static méthode

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
Résultat void

CheckScrollAndMovement() public static méthode

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
Résultat void

RegisterLocation() public static méthode

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.
Résultat void

RemovePressedElement() public static méthode

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

SetMouseFromCenter() public static méthode

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.
Résultat void