MCPcopy Create free account
hub / github.com/OpenMW/openmw / InputControlSystem

Method InputControlSystem

extern/oics/ICSInputControlSystem.cpp:33–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 15

maxFunction · 0.85
addControlFunction · 0.85
c_strMethod · 0.80
ErrorMethod · 0.80
ErrorRowMethod · 0.80
ErrorColMethod · 0.80
ErrorDescMethod · 0.80
RootElementMethod · 0.80
AttributeMethod · 0.80
addBezierIntervalMethod · 0.80
attachChannelMethod · 0.80
LoadFileMethod · 0.45

Tested by

no test coverage detected