(Edit: I’ve double-checked and I’m looking at Windows Form documentation, not XNA Input. But I think my question is still valid - as in “Why shouldn’t I just use Windows Form instead for both Keyboard and Mouse?” Or what?)
What are the pros and cons of using Keys
(of Windows Forms, not XNA) instead of MouseState
/ ButtonState
(of XNA Input) for Mouse input detection? I know that ButtonState
provides Pressed and Released events, but I need a Held event as well, so I might as well write those three methods myself, since they’re literally just 2-3 lines long. Or are there other reasons why the Mouse
class must be used?
// Edit: System.Windows.Input.Keyboard, not KeyboardState)
if (OldSystemState.IsKeyDown(Keys.LButton)
&& newSystemState.IsKeyDown(Keys.LButton))
{
DoStuff();
}
Versus:
// _mouse object:
if (OldMouseState.LeftButton == ButtonState.Pressed
&& newMouseState.LeftButton == ButtonState.Pressed)
{
DoStuff();
}
I’m in the middle of something else, but I’ll test it later myself. But if any of you have a quick answer or can explain why they both exist, then I’d appreciate it. Thanks.