| 31 | const float ICS_MAX = std::numeric_limits<float>::max(); |
| 32 | |
| 33 | InputControlSystem::InputControlSystem(std::string file, bool active |
| 34 | , DetectingBindingListener* detectingBindingListener |
| 35 | , InputControlSystemLog* log, size_t channelCount) |
| 36 | : mFileName(file) |
| 37 | , mDeadZone(0.1f) |
| 38 | , mLog(log) |
| 39 | , mDetectingBindingListener(detectingBindingListener) |
| 40 | , mDetectingBindingControl(NULL) |
| 41 | , mDetectingBindingDirection(Control::STOP) |
| 42 | , mXmouseAxisBinded(false), mYmouseAxisBinded(false) |
| 43 | , mClientWidth(1) |
| 44 | , mClientHeight(1) |
| 45 | , mMouseAxisBindingInitialValues{0} |
| 46 | { |
| 47 | ICS_LOG(" - Creating InputControlSystem - "); |
| 48 | |
| 49 | this->mActive = active; |
| 50 | |
| 51 | ICS_LOG("Channel count = " + ToString<size_t>(channelCount) ); |
| 52 | for(size_t i=0;i<channelCount;i++) |
| 53 | { |
| 54 | mChannels.push_back(new Channel((int)i)); |
| 55 | } |
| 56 | |
| 57 | if(file != "") |
| 58 | { |
| 59 | TiXmlDocument* xmlDoc; |
| 60 | TiXmlElement* xmlRoot; |
| 61 | |
| 62 | ICS_LOG("Loading file \""+file+"\""); |
| 63 | |
| 64 | xmlDoc = new TiXmlDocument(file.c_str()); |
| 65 | xmlDoc->LoadFile(); |
| 66 | |
| 67 | if(xmlDoc->Error()) |
| 68 | { |
| 69 | std::ostringstream message; |
| 70 | message << "TinyXml reported an error reading \""+ file + "\". Row " << |
| 71 | (int)xmlDoc->ErrorRow() << ", Col " << (int)xmlDoc->ErrorCol() << ": " << |
| 72 | xmlDoc->ErrorDesc() ; |
| 73 | ICS_LOG(message.str()); |
| 74 | |
| 75 | delete xmlDoc; |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | xmlRoot = xmlDoc->RootElement(); |
| 80 | if(std::string(xmlRoot->Value()) != "Controller") { |
| 81 | ICS_LOG("Error: Invalid Controller file. Missing <Controller> element."); |
| 82 | delete xmlDoc; |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | TiXmlElement* xmlControl = xmlRoot->FirstChildElement("Control"); |
| 87 | |
| 88 | size_t controlChannelCount = 0; |
| 89 | while(xmlControl) |
| 90 | { |
nothing calls this directly
no test coverage detected