Capturing Mouse Positions

I'm currently helping someone out with an XNA to Android port for the game FlyTrap, and I'm using MonoGame in between. You can check out a video of the game here:

The port is going pretty well, except for one thing. The guy who hired me is building an arcade machine, based off a cubieboard2, his plan is to attach two arcade joysticks. Apparently the arcade joysticks he has imitate a Mouse on Android.

The plan is to capture the position of the mouse every frame, calculate a delta value between this frame and the previous frame, and use that delta to direct player movement. The problem is Mouse.GetState doesn't seem to work. So I'm thinking I will have to work on a Mono.Android level instead of a MonoGame level.

Long story short, does anyone know how to capture the position of a mouse in Android?

Angus

Posts

  • CheesebaronCheesebaron DKInsider, University mod

    Not sure at all how you capture mouse. But Views in Android have a Touch event, which then has MotionEvent arguments. MotionEvent can give you all the information you need, such as X and Y coordinates, the pressure applied on the touch, give you information on how many fingers you touched the screen with etc. Maybe this can help you?

Sign In or Register to comment.