• 11
• 9
• 10
• 9
• 11

# Can you spot what I'm doing wrong? DirectXTK problem

This topic is 699 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello everybody I'm back again with some more interesting problems that I need help solving.  So I have moved forward with my engine and I'm working on the Input system for it I had Input from a keyboard working before and decided that it was time to add support for a game controller.  When I started working on this I also decided to change my input system so that it would be easier for me to change controls and to allow for Change in Key bindings in an options menu.

I'm running into a very interesting bug the reason why it is interesting to me is that the code kinda works, it receives the input commands it processes them for me.  Keyboard Commands get handled perfectly with no issues.  But when it comes to the game pad controls I'm getting some abnormalities.  So if I setup my code for checking for Directional pad presses like this:

if (tracker.dpadUp == GamePad::ButtonStateTracker::PRESSED && ((*commandIterator)->getGamePadDpadBinding() == Up))
(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);


It will process DPad PRESSED lines correctly but will ignore the RELEASED lines but all directions will work.  Now if I change it to this:

if (tracker.dpadUp == GamePad::ButtonStateTracker::PRESSED && ((*commandIterator)->getGamePadDpadBinding() == Up))
(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);

(*commandIterator)->execute(true);

(*commandIterator)->execute(false);


It recognizes both states PRESSED and UP and if I put a break point I can see that it catches on both cases PRESSED and UP but it ignores whatever the first action is like for example I have it setup so that if Left is Pressed it will scroll the map Left and if Right is pressed it scrolls Right.

If I step through the code it triggers on the LEFT it calls the execute method which calls the callback function that handles moving the map correctly but it will not move it.  I'm stumped on this one I've spent probably close to 5 hours trying to solve this issue and I know it is probably something simple that I'm just missing which is why I'm hoping that a fresh set of eyes will spot the bug.  So please help.

If you need more code related to the issue to understand it please ask.