| 154 | } |
| 155 | |
| 156 | void InputConfig::writeToXML(pugi::xml_node parent) |
| 157 | { |
| 158 | pugi::xml_node cfg = parent.append_child("inputConfig"); |
| 159 | |
| 160 | if(mDeviceId == DEVICE_KEYBOARD) |
| 161 | { |
| 162 | cfg.append_attribute("type") = "keyboard"; |
| 163 | }else{ |
| 164 | cfg.append_attribute("type") = "joystick"; |
| 165 | cfg.append_attribute("deviceName") = SDL_JoystickName(mDeviceId); |
| 166 | } |
| 167 | |
| 168 | typedef std::map<std::string, Input>::iterator it_type; |
| 169 | for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++) |
| 170 | { |
| 171 | if(!iterator->second.configured) |
| 172 | continue; |
| 173 | |
| 174 | pugi::xml_node input = cfg.append_child("input"); |
| 175 | input.append_attribute("name") = iterator->first.c_str(); |
| 176 | input.append_attribute("type") = inputTypeToString(iterator->second.type).c_str(); |
| 177 | input.append_attribute("id").set_value(iterator->second.id); |
| 178 | input.append_attribute("value").set_value(iterator->second.value); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | void InputConfig::setPlayerNum(int num) { mPlayerNum = num; } |
| 183 | int InputConfig::getPlayerNum() { return mPlayerNum; } |
no test coverage detected