Skip to content

MouseStateManager.cs

Charles Humphrey edited this page Nov 16, 2017 · 3 revisions

RandomchaosMGBase.InputManagers.MouseStateManager

This class derives from GameComponent and manages all mouse input.

Public Fields

MouseState State

The MouseState this frame. Update in call to Update(GameTime gameTime)

MouseState LastState

The MouseState last frame. Update in call to PreUpdate(GameTime gameTime)

Point ScreenPoint

The integer based position of the mouse on the screen.

Vector2 Position

The float based position of the mouse on the screen.

Vector2 LastPosition

Position of the mouse last frame.

Vector2 Direction

Direction the mouse is currently travelling in.

Vector2 Velocity

Velocity the mouse is currently travelling in.

Public Properties

Rectangle PositionRect

The position of the mouse as a Rectangle, used for Rectangle Intersection.

bool LeftClicked

True if the Left button is clicked.

bool RightClicked

True if the Right button is clicked.

bool MiddleClicked

True if the Middle button is clicked.

bool XButton1Clicked

True if the XButton1 is clicked.

bool XButton2Clicked

True if the XButton2 is clicked.

bool InitialLeftButtonDown

True if the Left button was first down this frame.

bool InitialRightButtonDown

True if the Rightbutton was first down this frame.

bool InitialMiddleButtonDown

True if the Middle button was first down this frame.

ButtonState LeftButtonState

Current ButtonState of the Left button.

ButtonState RighttButtonState

Current ButtonState of the Right button.

ButtonState MiddleButtonState

Current ButtonState of the Middle button.

bool LeftButtonDown

True if the Left button is down.

bool RightButtonDown

True if the Right button is down.

bool MiddleButtonDown

True if the Middle button is down.

bool XButton1ButtonDown

True if the XButton1 is down.

bool XButton2ButtonDown

True if the XButton2 is down.

int ScrollWheelValue

Current value of the scroll wheel.

int ScrollWheelDelta

Scroll wheel delta from last to this frame.

Vector2 PositionDelta

Mouse position delta from last to this frame.

Public Methods

MouseStateManager(Game game)

This is the constructor, it adds it's self to the Game.Components list as well as adds it's self to Game.Services

void Update(GameTime gameTime)

Sets the current state.

PreUpdate(GameTime gameTime)

Sets the last state to current state. This should be called at the top of the Game.Update method.

Clone this wiki locally