Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MouseState previousMouseState;
- protected override void Initialize()
- {
- // TODO: Add your initialization logic here
- //store the current state of the mouse
- previousMouseState = Mouse.GetState();
- }
- protected override void Update(GameTime gameTime)
- {
- // .. other update code
- //is there a mouse click?
- //A mouse click occurs if the goes from a released state
- //in the previous frame to a pressed state
- //in the current frame
- if (previousMouseState.LeftButton == ButtonState.Released
- && Mouse.GetState().LeftButton == ButtonState.Pressed)
- {
- //do your mouse click response...
- }
- //save the current mouse state for the next frame
- // the current
- previousMouseState = Mouse.GetState();
- base.Update(gameTime);
- }
- //Create this variable
- MouseState mouseState;
- mouseState = Mouse.GetState();
- if (mouse.RightButton == ButtonState.Pressed)
- {
- //Do Stuff
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement