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

Method loadMouseButtonBinders

extern/oics/ICSInputControlSystem_mouse.cpp:63–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 }
62
63 void InputControlSystem::loadMouseButtonBinders(TiXmlElement* xmlControlNode)
64 {
65 TiXmlElement* xmlMouseButtonBinder = xmlControlNode->FirstChildElement("MouseButtonBinder");
66 while(xmlMouseButtonBinder)
67 {
68 Control::ControlChangingDirection dir = Control::STOP;
69 if(std::string(xmlMouseButtonBinder->Attribute("direction")) == "INCREASE")
70 {
71 dir = Control::INCREASE;
72 }
73 else if(std::string(xmlMouseButtonBinder->Attribute("direction")) == "DECREASE")
74 {
75 dir = Control::DECREASE;
76 }
77
78 int button = 0;
79 if(std::string(xmlMouseButtonBinder->Attribute("button")) == "LEFT")
80 {
81 button = SDL_BUTTON_LEFT;
82 }
83 else if(std::string(xmlMouseButtonBinder->Attribute("button")) == "RIGHT")
84 {
85 button = SDL_BUTTON_RIGHT;
86 }
87 else if(std::string(xmlMouseButtonBinder->Attribute("button")) == "MIDDLE")
88 {
89 button = SDL_BUTTON_MIDDLE;
90 }
91 else
92 {
93 button = FromString<int>(xmlMouseButtonBinder->Attribute("button"));
94 }
95
96 addMouseButtonBinding(mControls.back(), button, dir);
97
98 xmlMouseButtonBinder = xmlMouseButtonBinder->NextSiblingElement("MouseButtonBinder");
99 }
100 }
101
102
103 // add bindings

Callers

nothing calls this directly

Calls 3

AttributeMethod · 0.80
FirstChildElementMethod · 0.45
NextSiblingElementMethod · 0.45

Tested by

no test coverage detected