Skip to main content
added 43 characters in body
Source Link
Blau
  • 3.4k
  • 17
  • 19

You can do it in a similar way to keyboard, storing the state by yourself:

   enum States {None, GoingDown, GoingUp }

   States Current, Previous;

   void Update()
   {
           Previous = Current;

           if (thumbStiscks.Y>0.5 || keyState.IsKeyDown(Keys.Up))
               State = States.GoingUpGoingUp;
           else if (thumbSticks.Y<-0.5f || keyState.IskeyDown(Keys.Down)) Sate
               State = States.GoingDownGoingDown;
           else State = States.None;

           if ( Current == States.GoingDown  && Previous != States.GoingDown) 
                && selected < (buttonList.Count - 1)) {
             selected++;
  ..         }
           else if ( Current == States.GoingUp && Previous != States.GoingUp) 
           }
          && selected >0) {
           ....  selected--;
          }
   }

Maybe a good idea using keyboard to change the Current state too.

You can do it in a similar way to keyboard, storing the state by yourself:

   enum States {None, GoingDown, GoingUp }

   States Current, Previous;

   void Update()
   {
           Previous = Current;

           if (thumbStiscks.Y>0.5) State = States.GoingUp
           else if (thumbSticks.Y<-0.5f) Sate = States.GoingDown
           else State = States.None;

           if (Current == States.GoingDown && Previous != States.GoingDown) 
           {
               ....
           }

           ....

   }

Maybe a good idea using keyboard to change the Current state too.

You can do it in a similar way to keyboard, storing the state by yourself:

   enum States {None, GoingDown, GoingUp }

   States Current, Previous;

   void Update()
   {
           Previous = Current;

           if (thumbStiscks.Y>0.5 || keyState.IsKeyDown(Keys.Up))
               State = States.GoingUp;
           else if (thumbSticks.Y<-0.5f || keyState.IskeyDown(Keys.Down)) 
               State = States.GoingDown;
           else State = States.None;

           if ( Current == States.GoingDown  && Previous != States.GoingDown) 
                && selected < (buttonList.Count - 1)) {
             selected++;
           }
           else if ( Current == States.GoingUp && Previous != States.GoingUp) 
                     && selected >0) {
             selected--;
          }
   }
Source Link
Blau
  • 3.4k
  • 17
  • 19

You can do it in a similar way to keyboard, storing the state by yourself:

   enum States {None, GoingDown, GoingUp }

   States Current, Previous;

   void Update()
   {
           Previous = Current;

           if (thumbStiscks.Y>0.5) State = States.GoingUp
           else if (thumbSticks.Y<-0.5f) Sate = States.GoingDown
           else State = States.None;

           if (Current == States.GoingDown && Previous != States.GoingDown) 
           {
               ....
           }

           ....

   }

Maybe a good idea using keyboard to change the Current state too.