Color legend plain property method event
Reads the mouse at every update, or takes a state the game built: its five buttons, the pointer and both wheels, with events for what changed.
A static class, in the namespace BorrowedTorch.MonoInput.Inputs.Mouse. It holds one MouseStatus for the whole run. Its events are raised from inside its update methods, on the game thread. The mouse page shows it in context, with code.
Names are colored by what they are: a property, a method or an event; values and fields keep the plain color.
Properties
MouseStatus →
MouseStatus · Static, read-only. The mouse as of the last update. The same object for the whole run, so a reference to it stays good.
Methods
GetButtonsStates() →
GetButtonsStates() · Static. Returns a new MouseButtonsStates: the states of the five buttons as they are now. Allocates.
Update() →
Update() · Static. Reads the mouse once with Mouse.GetState() and updates the pointer, the wheels and the buttons, in that order, raising their events. Call it once per frame, before anything reads the mouse.
Update(MouseState mouseState) · Static. The same, over a state the game built instead of the mouse: for a mouse that never reaches MonoGame’s Mouse, such as an editor viewport’s in a window of its own, and for replays and tests. Once per frame too, in place of Update(): the two move the same status.
| Parameter | Type | Description |
|---|---|---|
mouseState |
MouseState |
The mouse now: the position in the view’s pixels from its top-left corner, the wheels as running totals, and the five buttons. |
UpdateButtonsStates() →
UpdateButtonsStates() · Static. Reads the mouse and moves the five buttons one step, nothing else. Raises OnButtonsStatesChanged when any of them changed.
UpdateButtonsStates(MouseState mouseState) · Static. The same, with the buttons of the state passed instead of the mouse’s.
| Parameter | Type | Description |
|---|---|---|
mouseState |
MouseState |
The mouse now. Only its five buttons are read. |
UpdatePositionData() →
UpdatePositionData() · Static. Reads the mouse and updates Position and PositionDelta, nothing else. Raises OnPositionChanged when the pointer moved.
UpdatePositionData(MouseState mouseState) · Static. The same, with the position of the state passed instead of the mouse’s.
| Parameter | Type | Description |
|---|---|---|
mouseState |
MouseState |
The mouse now. Only its position is read, in the view’s pixels from its top-left corner. |
UpdateWheelsData() →
UpdateWheelsData() · Static. Reads the mouse and updates the two wheels, nothing else. Raises the event of each wheel that turned.
UpdateWheelsData(MouseState mouseState) · Static. The same, with the wheel totals of the state passed instead of the mouse’s.
| Parameter | Type | Description |
|---|---|---|
mouseState |
MouseState |
The mouse now. Only its two wheel totals are read, running totals as MonoGame keeps them: the deltas are worked out from them. |
Events
OnButtonsStatesChanged →
(MouseButtonsStates mouseButtonsStates) · Static. A button changed state at an update, at any step: Idle to Pressed, Pressed to Down, to Up, and back to Idle. Raised once per update, after all five buttons have moved.
| Parameter | Type | Description |
|---|---|---|
mouseButtonsStates |
MouseButtonsStates |
The five states after the update, a new snapshot each time. |
OnHorizontalWheelDeltaChanged →
(int delta) · Static. The horizontal wheel turned since the last update. Raised at every update it turns, not only when the amount changes.
| Parameter | Type | Description |
|---|---|---|
delta |
int |
How far it turned: HorizontalWheelDelta. |
OnPositionChanged →
(Point newPosition) · Static. The pointer is somewhere new at an update, also at the first update unless it starts at (0, 0). Raised before the wheels and the buttons update, so the buttons still hold their states of the update before.
| Parameter | Type | Description |
|---|---|---|
newPosition |
Point |
The new Position, in window pixels. |
OnWheelDeltaChanged →
(int delta) · Static. The wheel turned since the last update. Raised at every update it turns, not only when the amount changes.
| Parameter | Type | Description |
|---|---|---|
delta |
int |
How far it turned: WheelDelta. |