| 24 | } |
| 25 | |
| 26 | bool GuiInputConfig::input(InputConfig* config, Input input) |
| 27 | { |
| 28 | if(config != mTargetConfig || input.value == 0) |
| 29 | return false; |
| 30 | |
| 31 | if(mCurInputId >= inputCount) |
| 32 | { |
| 33 | //done |
| 34 | if(input.type == TYPE_BUTTON || input.type == TYPE_KEY) |
| 35 | { |
| 36 | if(mTargetConfig->getPlayerNum() < mWindow->getInputManager()->getNumPlayers() - 1) |
| 37 | { |
| 38 | mWindow->pushGui(new GuiInputConfig(mWindow, mWindow->getInputManager()->getInputConfigByPlayer(mTargetConfig->getPlayerNum() + 1))); |
| 39 | }else{ |
| 40 | mWindow->getInputManager()->writeConfig(); |
| 41 | mWindow->getInputManager()->startPolling(); //enable polling again since we're done |
| 42 | GuiGameList::create(mWindow); |
| 43 | } |
| 44 | delete this; |
| 45 | return true; |
| 46 | } |
| 47 | }else{ |
| 48 | if(mCanSkip && config->isMappedTo("a", input)) |
| 49 | { |
| 50 | mCurInputId++; |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | if(config->getMappedTo(input).size() > 0) |
| 55 | { |
| 56 | mErrorMsg = "Already mapped!"; |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | input.configured = true; |
| 61 | LOG(LogInfo) << " [" << input.string() << "] -> " << inputName[mCurInputId]; |
| 62 | |
| 63 | config->mapInput(inputName[mCurInputId], input); |
| 64 | mCurInputId++; |
| 65 | mErrorMsg = ""; |
| 66 | |
| 67 | //for buttons with not enough buttons, press A to skip |
| 68 | if(mCurInputId >= 7) |
| 69 | { |
| 70 | mCanSkip = true; |
| 71 | } |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | void GuiInputConfig::render(const Eigen::Affine3f& parentTrans) |
| 79 | { |
nothing calls this directly
no test coverage detected