MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / process

Method process

Engine/source/platformWin32/winConsole.cpp:166–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void WinConsole::process()
167{
168 if(winConsoleEnabled)
169 {
170 DWORD numEvents;
171 GetNumberOfConsoleInputEvents(stdIn, &numEvents);
172 if(numEvents)
173 {
174 INPUT_RECORD rec[20];
175 char outbuf[512];
176 S32 outpos = 0;
177
178 ReadConsoleInput(stdIn, rec, 20, &numEvents);
179 DWORD i;
180 for(i = 0; i < numEvents; i++)
181 {
182 if(rec[i].EventType == KEY_EVENT)
183 {
184 KEY_EVENT_RECORD *ke = &(rec[i].Event.KeyEvent);
185 if(ke->bKeyDown)
186 {
187 switch (ke->uChar.AsciiChar)
188 {
189 // If no ASCII char, check if it's a handled virtual key
190 case 0:
191 switch (ke->wVirtualKeyCode)
192 {
193 // UP ARROW
194 case 0x26 :
195 // Go to the previous command in the cyclic array
196 if ((-- iCmdIndex) < 0)
197 iCmdIndex = MAX_CMDS - 1;
198
199 // If this command isn't empty ...
200 if (rgCmds[iCmdIndex][0] != '\0')
201 {
202 // Obliterate current displayed text
203 for (S32 i = outpos = 0; i < inpos; i ++)
204 {
205 outbuf[outpos ++] = '\b';
206 outbuf[outpos ++] = ' ';
207 outbuf[outpos ++] = '\b';
208 }
209
210 // Copy command into command and display buffers
211 for (inpos = 0; inpos < (S32)strlen(rgCmds[iCmdIndex]); inpos ++, outpos ++)
212 {
213 outbuf[outpos] = rgCmds[iCmdIndex][inpos];
214 inbuf [inpos ] = rgCmds[iCmdIndex][inpos];
215 }
216 }
217 // If previous is empty, stay on current command
218 else if ((++ iCmdIndex) >= MAX_CMDS)
219 {
220 iCmdIndex = 0;
221 }
222
223 break;

Callers

nothing calls this directly

Calls 4

tabCompleteFunction · 0.85
printfFunction · 0.85
getVariableFunction · 0.85
triggerMethod · 0.45

Tested by

no test coverage detected