JoystickManager(InputManager* pInputMgr, EventHandler* pEventHdlr) : _pInputMgr(pInputMgr), _nCurrJoyInd(-1), _dMasterGain(0.5), _bAutoCenter(true) { _bFFFound = false; for( int nJoyInd = 0; nJoyInd < pInputMgr->getNumberOfDevices(OISJoyStick); ++nJoyInd ) { //Create the stick JoyStick* pJoy = (JoyStick*)pInputMgr->createInputObject( OISJoyStick, true ); cout << endl << "Created buffered joystick #" << nJoyInd << " '" << pJoy->vendor() << "' (Id=" << pJoy->getID() << ")"; // Check for FF, and if so, keep the joy and dump FF info ForceFeedback* pFFDev = (ForceFeedback*)pJoy->queryInterface(Interface::ForceFeedback ); if( pFFDev ) { _bFFFound = true; // Keep the joy to play with it. pJoy->setEventCallback(pEventHdlr); _vecJoys.push_back(pJoy); // Keep also the associated FF device _vecFFDev.push_back(pFFDev); // Dump FF supported effects and other info. cout << endl << " * Number of force feedback axes : " << pFFDev->getFFAxesNumber() << endl; const ForceFeedback::SupportedEffectList &lstFFEffects = pFFDev->getSupportedEffects(); if (lstFFEffects.size() > 0) { cout << " * Supported effects :"; ForceFeedback::SupportedEffectList::const_iterator itFFEff; for(itFFEff = lstFFEffects.begin(); itFFEff != lstFFEffects.end(); ++itFFEff) cout << " " << Effect::getEffectTypeName(itFFEff->second); cout << endl << endl; } else cout << "Warning: no supported effect found !" << endl; } else { cout << " (no force feedback support detected) => ignored." << endl << endl; _pInputMgr->destroyInputObject(pJoy); } } }