MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / SendCharacter

Method SendCharacter

SDK/src/NDK/Console.cpp:133–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

SetTextMethod · 0.80
GetLengthMethod · 0.45
ResizeMethod · 0.45
AppendTextMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected