Exemple #1
0
 public Dinosaur( int maxWidth, int maxHeight, ContentManager content )
 {
     touchPanelCapabilities = TouchPanel.GetCapabilities();
     touchPosition = new Vector2();
     DinosaurTex = content.Load<Texture2D>( "Textures/dinosaur" );
     this.maxWidth = maxWidth;
     this.maxHeight = maxHeight;
     this.Position = new Vector2( maxWidth / 2, maxHeight / 2 );
 }
Exemple #2
0
 public void Initialize()
 {
     this.tc = TouchPanel.GetCapabilities();
 }
 public TouchPanelCapabilitiesEx(TouchPanelCapabilities copy)
 {
     IsConnected = copy.IsConnected;
     MaximumTouchCount = copy.MaximumTouchCount;
     HasPressure = copy.HasPressure;
 }
Exemple #4
0
        public void Update(GameTime gameTime)
        {
            // Check if finish
            //if() IsItFinish();
            elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            // --> ManageEnd = new FinishScreen();
            if (ListDragObj.Count == 0)
            {
                foreach (Borne br in ListBrn)
                {
                    br.islight = false;
                }
            }
                touchCap = TouchPanel.GetCapabilities();
                if (touchCap.IsConnected)
                {
                    touches = TouchPanel.GetState();
                    // si il y a un touch
                    if (touches.Count >= 1)
                        {
                        Vector2 PositionTouch = touches[0].Position;
                        // getselectedobj (recois la position touch, return : index de l'obj sel
                        // update la position --> check dans la grid si pas possible ---> remet la pos saved au dessu de la fonction
                        // Mouve blueberry

                        TouchPanel.EnabledGestures =
                       GestureType.Tap |
                       GestureType.DoubleTap |
                       GestureType.FreeDrag;

                         while (TouchPanel.IsGestureAvailable)
                        {
                            GestureSample gesture = TouchPanel.ReadGesture();

                            switch (gesture.GestureType)
                            {
                             case GestureType.DoubleTap:
                                HandleButtonVise((int)gesture.Position.X, (int)gesture.Position.Y);
                                break;
                             case GestureType.Tap:
                                Mouseclik((int)gesture.Position.X, (int)gesture.Position.Y);
                                break;
                             case GestureType.FreeDrag:
                                CheckMoove(gesture.Position);
                                break;

                             // on peut pas rajouter de case
                             // la shape se met pas au bonne endroit
                            }
                        }
                            // cmt annuler la visé ? ----> Polygo fermé;

                        // if pas en mode pause

                            // fonction qui check si une station est selectionné.

                        // ----> Rajouter pour un freedrag clik puis drag , sans drag + drag
                          // CheckMoove(PositionTouch);

                    }
                }
                foreach (Vise vs in ListVise)
                {
                    vs.Update();
                }
        }
 public XnaTouchState(TouchCollection touchCollection, TouchPanelCapabilities capabilities, bool isGestureAvailable,
     GestureSample? gestureSample)
 {
     this.touchCollection = touchCollection;
     this.capabilities = capabilities;
     this.isGestureAvailable = isGestureAvailable;
     this.gestureSample = gestureSample;
 }
Exemple #6
0
        public void Update(GameTime gameTime)
        {
            double ClickTimer = 0;
            const double TimerDelay = 500;

            if (ListDragObj.Count == 0)
            {
                foreach (Borne br in ListBrn)
                {
                    br.islight = false;
                }
            }

            //prevmouse = curmouse;

            curmouse = Mouse.GetState();
            ClickTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            // line to use with mouse on tablet
            if (curmouse.LeftButton == ButtonState.Pressed && prevmouse.LeftButton == ButtonState.Released)
            {
                    Mouseclik((int)curmouse.X, (int)curmouse.Y);
            }
            else if (curmouse.LeftButton == ButtonState.Pressed && prevmouse.LeftButton == ButtonState.Pressed)
            {
                 CheckMoove(new Vector2(curmouse.X, curmouse.Y));
            }
            if (curmouse.LeftButton == ButtonState.Pressed && prevmouse.LeftButton == ButtonState.Released && ClickTimer < TimerDelay)
                    HandleButtonVise((int)curmouse.X, (int)curmouse.Y);
            // released et press differement

            prevmouse = curmouse;
            ppmouse = prevmouse;
            pppmouse = ppmouse;

                 touchCap = TouchPanel.GetCapabilities();

                    TouchPanel.EnabledGestures =
                   GestureType.Tap |
                   GestureType.DoubleTap |
                   GestureType.FreeDrag;

                    while (TouchPanel.IsGestureAvailable)
                    {
                        GestureSample gesture = TouchPanel.ReadGesture();

                        switch (gesture.GestureType)
                        {
                            case GestureType.DoubleTap:
                                HandleButtonVise((int)gesture.Position.X, (int)gesture.Position.Y);
                                break;
                            case GestureType.Tap:
                                Mouseclik((int)gesture.Position.X, (int)gesture.Position.Y);
                                break;
                            case GestureType.FreeDrag:
                                CheckMoove(gesture.Position);
                                break;
                          }
                    }
            foreach (Vise vs in ListVise)
            {
                vs.Update();
            }
        }
Exemple #7
0
 public static TouchPanelCapabilities GetCapabilities()
 {
     // Go off and create an updated TouchPanelCapabilities with the latest state
     touchPanelCapabilities = new TouchPanelCapabilities(false,true,8);
     return touchPanelCapabilities;
 }
 public static TouchPanelCapabilities GetCapabilities()
 {
     // Go off and create an updated TouchPanelCapabilities with the latest state
     touchPanelCapabilities = new TouchPanelCapabilities(false, true, 8);
     return(touchPanelCapabilities);
 }