NInput class

Here's the NInput class, in which you can see how to process input. This class is different from The Hazy Mind class in some things like you can read the scroll wheel value etc... Suite it to your needs :)

http://paste.lisp.org/display/40867

The way you use the class: first, create a new object:

NInput input = new NInput();
input.Initialize();

and everytime the frame is updated call

input.Updat(gameTime);

To check for keys:

input.Keys.Contains(Keys.A);

for mouse buttons

input.MouseButtons[0] - left mouse button
input.MouseButtons[1] - middle mouse button
input.MouseButtons[2] - right mouse button

e.g. if (input.MouseButtons[0] == ButtonState.Pressed)

:)

Also, I forgot to mention, set the ViewportCenterX and ViewportCenterY to WindowWidth / 2 and WindowHeight / 2

0 comments:


 

Copyright 2006| Blogger Templates by GeckoandFly modified and converted to Blogger Beta by Blogcrowds.
No part of the content or the blog may be reproduced without prior written permission.