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

Method SendEvent

SDK/src/NDK/Console.cpp:171–214  ·  view source on GitHub ↗

! * \brief Sends an event to the console * * \param event Event to be takin into consideration by the console */

Source from the content-addressed store, hash-verified

169 * \param event Event to be takin into consideration by the console
170 */
171 void Console::SendEvent(const Nz::WindowEvent& event)
172 {
173 switch (event.type)
174 {
175 case Nz::WindowEventType_TextEntered:
176 SendCharacter(event.text.character);
177 break;
178
179 case Nz::WindowEventType_KeyPressed:
180 {
181 switch (event.key.code)
182 {
183 case Nz::Keyboard::Down:
184 case Nz::Keyboard::Up:
185 {
186 if (event.key.code == Nz::Keyboard::Up)
187 m_historyPosition = std::min<std::size_t>(m_commandHistory.size(), m_historyPosition + 1);
188 else
189 {
190 if (m_historyPosition > 1)
191 m_historyPosition--;
192 else if (m_historyPosition == 0)
193 m_historyPosition = 1;
194 }
195
196 if (!m_commandHistory.empty())
197 {
198 Nz::String text = m_commandHistory[m_commandHistory.size() - m_historyPosition];
199 m_inputDrawer.SetText(s_inputPrefix + text);
200 m_inputTextSprite->Update(m_inputDrawer);
201 }
202 break;
203 }
204
205 default:
206 break;
207 }
208 break;
209 }
210
211 default:
212 break;
213 }
214 }
215
216 /*!
217 * \brief Sets the character size

Callers 1

SetupConsoleMethod · 0.80

Calls 2

SetTextMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected