Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2008, 9:07:08 PM (16 years ago)
Author:
rgrieder
Message:
  • merged input branch back to trunk
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/ois/win32/Win32JoyStick.cpp

    r1219 r1349  
    149149        diptr.diph.dwHow        = DIPH_BYID;
    150150        diptr.diph.dwObj        = lpddoi->dwType;
    151         //Add the high bit in so that an axis value of zero does not mean a null userdata
    152         diptr.uData             = 0x80000000 | _this->_AxisNumber;
     151        //Add a magic number to recognise we set seomthing
     152        diptr.uData             = 0x13130000 | _this->_AxisNumber;
    153153
    154154        //Check if axis is slider, if so, do not treat as regular axis
     
    166166
    167167        //Increase for next time through
    168         _this->_AxisNumber += 1;
     168        if(GUID_Slider != lpddoi->guidType)
     169                _this->_AxisNumber += 1;
    169170
    170171        //Set range
     
    238239        for(unsigned int i = 0; i < entries; ++i)
    239240        {
    240                 //First check to see if event entry is a Axis we enumerated earlier
    241                 if( diBuff[i].uAppData != 0xFFFFFFFF && diBuff[i].uAppData > 0 )
     241                //This may seem outof order, but is in order of the way these variables
     242                //are declared in the JoyStick State 2 structure.
     243                switch(diBuff[i].dwOfs)
    242244                {
    243                         int axis = (int)(0x7FFFFFFF & diBuff[i].uAppData); //Mask out the high bit
    244                         assert( axis >= 0 && axis < (int)mState.mAxes.size() && "Axis out of range!");
    245                         mState.mAxes[axis].abs = diBuff[i].dwData;
    246                         axisMoved[axis] = true;
    247                 }
    248                 else
    249                 {
    250                         //This may seem outof order, but is in order of the way these variables
    251                         //are declared in the JoyStick State 2 structure.
    252                         switch(diBuff[i].dwOfs)
     245                //------ slider -//
     246                case DIJOFS_SLIDER0(0):
     247                        sliderMoved[0] = true;
     248                        mState.mSliders[0].abX = diBuff[i].dwData;
     249                        break;
     250                case DIJOFS_SLIDER0(1):
     251                        sliderMoved[0] = true;
     252                        mState.mSliders[0].abY = diBuff[i].dwData;
     253                        break;
     254                //----- Max 4 POVs Next ---------------//
     255                case DIJOFS_POV(0):
     256                        if(!_changePOV(0,diBuff[i]))
     257                                return;
     258                        break;
     259                case DIJOFS_POV(1):
     260                        if(!_changePOV(1,diBuff[i]))
     261                                return;
     262                        break;
     263                case DIJOFS_POV(2):
     264                        if(!_changePOV(2,diBuff[i]))
     265                                return;
     266                        break;
     267                case DIJOFS_POV(3):
     268                        if(!_changePOV(3,diBuff[i]))
     269                                return;
     270                        break;
     271                case DIJOFS_SLIDER1(0):
     272                        sliderMoved[1] = true;
     273                        mState.mSliders[1].abX = diBuff[i].dwData;
     274                        break;
     275                case DIJOFS_SLIDER1(1):
     276                        sliderMoved[1] = true;
     277                        mState.mSliders[1].abY = diBuff[i].dwData;
     278                        break;
     279                case DIJOFS_SLIDER2(0):
     280                        sliderMoved[2] = true;
     281                        mState.mSliders[2].abX = diBuff[i].dwData;
     282                        break;
     283                case DIJOFS_SLIDER2(1):
     284                        sliderMoved[2] = true;
     285                        mState.mSliders[2].abY = diBuff[i].dwData;
     286                        break;
     287                case DIJOFS_SLIDER3(0):
     288                        sliderMoved[3] = true;
     289                        mState.mSliders[3].abX = diBuff[i].dwData;
     290                        break;
     291                case DIJOFS_SLIDER3(1):
     292                        sliderMoved[3] = true;
     293                        mState.mSliders[3].abY = diBuff[i].dwData;
     294                        break;
     295                //-----------------------------------------//
     296                default:
     297                        //Handle Button Events Easily using the DX Offset Macros
     298                        if( diBuff[i].dwOfs >= DIJOFS_BUTTON(0) && diBuff[i].dwOfs < DIJOFS_BUTTON(128) )
    253299                        {
    254                         //------ slider -//
    255                         case DIJOFS_SLIDER0(0):
    256                                 sliderMoved[0] = true;
    257                                 mState.mSliders[0].abX = diBuff[i].dwData;
    258                                 break;
    259                         case DIJOFS_SLIDER0(1):
    260                                 sliderMoved[0] = true;
    261                                 mState.mSliders[0].abY = diBuff[i].dwData;
    262                                 break;
    263                         //----- Max 4 POVs Next ---------------//
    264                         case DIJOFS_POV(0):
    265                                 if(!_changePOV(0,diBuff[i]))
     300                                if(!_doButtonClick((diBuff[i].dwOfs - DIJOFS_BUTTON(0)), diBuff[i]))
    266301                                        return;
    267                                 break;
    268                         case DIJOFS_POV(1):
    269                                 if(!_changePOV(1,diBuff[i]))
    270                                         return;
    271                                 break;
    272                         case DIJOFS_POV(2):
    273                                 if(!_changePOV(2,diBuff[i]))
    274                                         return;
    275                                 break;
    276                         case DIJOFS_POV(3):
    277                                 if(!_changePOV(3,diBuff[i]))
    278                                         return;
    279                                 break;
    280                         case DIJOFS_SLIDER1(0):
    281                                 sliderMoved[1] = true;
    282                                 mState.mSliders[1].abX = diBuff[i].dwData;
    283                                 break;
    284                         case DIJOFS_SLIDER1(1):
    285                                 sliderMoved[1] = true;
    286                                 mState.mSliders[1].abY = diBuff[i].dwData;
    287                                 break;
    288                         case DIJOFS_SLIDER2(0):
    289                                 sliderMoved[2] = true;
    290                                 mState.mSliders[2].abX = diBuff[i].dwData;
    291                                 break;
    292                         case DIJOFS_SLIDER2(1):
    293                                 sliderMoved[2] = true;
    294                                 mState.mSliders[2].abY = diBuff[i].dwData;
    295                                 break;
    296                         case DIJOFS_SLIDER3(0):
    297                                 sliderMoved[3] = true;
    298                                 mState.mSliders[3].abX = diBuff[i].dwData;
    299                                 break;
    300                         case DIJOFS_SLIDER3(1):
    301                                 sliderMoved[3] = true;
    302                                 mState.mSliders[3].abY = diBuff[i].dwData;
    303                                 break;
    304                         //-----------------------------------------//
    305                         default:
    306                                 //Handle Button Events Easily using the DX Offset Macros
    307                                 if( diBuff[i].dwOfs >= DIJOFS_BUTTON(0) && diBuff[i].dwOfs < DIJOFS_BUTTON(128) )
     302                        }
     303                        else if((short)(diBuff[i].uAppData >> 16) == 0x1313)
     304                        {       //If it was nothing else, might be axis enumerated earlier (determined by magic number)
     305                                int axis = (int)(0x0000FFFF & diBuff[i].uAppData); //Mask out the high bit
     306                                assert( axis >= 0 && axis < (int)mState.mAxes.size() && "Axis out of range!");
     307
     308                                if(axis >= 0 && axis < (int)mState.mAxes.size())
    308309                                {
    309                                         if(!_doButtonClick((diBuff[i].dwOfs - DIJOFS_BUTTON(0)), diBuff[i]))
    310                                                 return;
     310                                        mState.mAxes[axis].abs = diBuff[i].dwData;
     311                                        axisMoved[axis] = true;
    311312                                }
    312                                 break;
    313                         } //end case
    314                 } //End else
     313                        }
     314
     315                        break;
     316                } //end case
    315317        } //end for
    316318
Note: See TracChangeset for help on using the changeset viewer.