| 83 | } |
| 84 | |
| 85 | bool GameEditorModeConsole::keyPressed(const OIS::KeyEvent &arg) |
| 86 | { |
| 87 | switch(arg.key) |
| 88 | { |
| 89 | case OIS::KC_TAB: |
| 90 | { |
| 91 | ConsoleInterface::String_t completed; |
| 92 | if(mConsoleInterface.tryCompleteCommand(mEditboxWindow->getText().c_str(), completed)) |
| 93 | mEditboxWindow->setText(completed); |
| 94 | |
| 95 | mEditboxWindow->setCaretIndex(mEditboxWindow->getText().length()); |
| 96 | break; |
| 97 | } |
| 98 | case OIS::KC_GRAVE: |
| 99 | case OIS::KC_ESCAPE: |
| 100 | case OIS::KC_F12: |
| 101 | { |
| 102 | leaveConsole(); |
| 103 | break; |
| 104 | } |
| 105 | case OIS::KC_UP: |
| 106 | if(auto completed = mConsoleInterface.scrollCommandHistoryPositionUp(mEditboxWindow->getText().c_str())) |
| 107 | { |
| 108 | mEditboxWindow->setText(completed.get()); |
| 109 | } |
| 110 | mEditboxWindow->setCaretIndex(mEditboxWindow->getText().length()); |
| 111 | break; |
| 112 | |
| 113 | case OIS::KC_DOWN: |
| 114 | { |
| 115 | if(auto completed = mConsoleInterface.scrollCommandHistoryPositionDown()) |
| 116 | { |
| 117 | mEditboxWindow->setText(completed.get()); |
| 118 | } |
| 119 | mEditboxWindow->setCaretIndex(mEditboxWindow->getText().length()); |
| 120 | break; |
| 121 | } |
| 122 | case OIS::KC_RETURN: |
| 123 | case OIS::KC_NUMPADENTER: |
| 124 | executeCurrentPrompt(); |
| 125 | break; |
| 126 | default: |
| 127 | break; |
| 128 | } |
| 129 | |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 | void GameEditorModeConsole::printToConsole(const std::string& text) |
| 134 | { |
nothing calls this directly
no test coverage detected