| 131 | */ |
| 132 | |
| 133 | void Console::SendCharacter(char32_t character) |
| 134 | { |
| 135 | switch (character) |
| 136 | { |
| 137 | case '\b': |
| 138 | { |
| 139 | Nz::String input = m_inputDrawer.GetText(); |
| 140 | if (input.GetLength() <= s_inputPrefixSize) // Prevent removal of the input prefix |
| 141 | return; // Ignore if no user character is there |
| 142 | |
| 143 | input.Resize(-1, Nz::String::HandleUtf8); |
| 144 | m_inputDrawer.SetText(input); |
| 145 | break; |
| 146 | } |
| 147 | |
| 148 | case '\r': |
| 149 | case '\n': |
| 150 | ExecuteInput(); |
| 151 | break; |
| 152 | |
| 153 | default: |
| 154 | { |
| 155 | if (Nz::Unicode::GetCategory(character) == Nz::Unicode::Category_Other_Control) |
| 156 | return; |
| 157 | |
| 158 | m_inputDrawer.AppendText(Nz::String::Unicode(character)); |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | m_inputTextSprite->Update(m_inputDrawer); |
| 164 | } |
| 165 | |
| 166 | /*! |
| 167 | * \brief Sends an event to the console |
nothing calls this directly
no test coverage detected