test/controllermap.c
changeset 10752 c9d3ff50dfcf
parent 10747 da1f4eeac65a
child 10824 e854440318d2
     1.1 --- a/test/controllermap.c	Wed Jan 04 07:06:48 2017 -0800
     1.2 +++ b/test/controllermap.c	Wed Jan 04 10:28:07 2017 -0800
     1.3 @@ -337,6 +337,7 @@
     1.4      Uint8 alpha=200, alpha_step = -1;
     1.5      Uint32 alpha_ticks = 0;
     1.6      SDL_JoystickID nJoystickID;
     1.7 +    int iIndex;
     1.8  
     1.9      /* Create a window to display joystick axis position */
    1.10      window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED,
    1.11 @@ -383,6 +384,13 @@
    1.12  
    1.13      s_nNumAxes = SDL_JoystickNumAxes(joystick);
    1.14      s_arrAxisState = SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState));
    1.15 +    for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) {
    1.16 +        AxisState *pAxisState = &s_arrAxisState[iIndex];
    1.17 +        Sint16 nInitialValue;
    1.18 +        pAxisState->m_bMoving = SDL_JoystickGetAxisInitialState(joystick, iIndex, &nInitialValue);
    1.19 +        pAxisState->m_nStartingValue = nInitialValue;
    1.20 +        pAxisState->m_nFarthestValue = nInitialValue;
    1.21 +    }
    1.22  
    1.23      /* Loop, getting joystick events! */
    1.24      while (!done && !s_bBindingComplete) {