Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Input.Touch;
- namespace GameStates
- {
- class Input
- {
- static Point index;
- public static void Init()
- {
- TouchPanel.EnabledGestures =
- GestureType.Hold |
- GestureType.Tap |
- GestureType.DoubleTap |
- GestureType.FreeDrag |
- GestureType.Flick |
- GestureType.Pinch;
- }
- public static void checkInput()
- {
- }
- public static bool checkTap()
- {
- while (TouchPanel.IsGestureAvailable)
- {
- GestureSample gesture = TouchPanel.ReadGesture();
- switch (gesture.GestureType)
- {
- case GestureType.Tap:
- return true;
- }
- }
- return false;
- }
- public static Point getPosition()
- {
- TouchCollection touches = TouchPanel.GetState();
- if (touches.Count > 0 && touches[0].State == TouchLocationState.Pressed)
- {
- index = new Point((int)touches[0].Position.X, (int)touches[0].Position.Y);
- return index;
- }
- return index;
- }
- }
- }
Add Comment
Please, Sign In to add comment