Search code examples
c#slimdx

SlimDx Events on button pressed


I am using slimdx to interpret xbox controller button presses. I poll every 200ms to read the xbox button states and all works for me. I use

        JoystickState state = Joystick.GetCurrentState();
        // get buttons states
        bool[] buttonsPressed = state.GetButtons();

Is there anyway to generate events on the button press instead of polling? To explain imagine if my poll time was 5 seconds. And the user presses a button in the 2nd second and releases it. In the next poll time my application will never know that the button was pressed


Solution

  • No - in DirectX you must poll. To do this efficiently you want to create a polling thread, and have a class which raises cross thread events to your consuming thread.