MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / inputLoop

Method inputLoop

engine/source/platformAndroid/AndroidConsole.cpp:141–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void AndroidConsole::inputLoop()
142{
143 Con::printf("Console Input Thread Started");
144 unsigned char c;
145 while(consoleEnabled)
146 {
147 c = fgetc(stdin);
148 if(c == '\n')
149 {
150 // exec the line
151 dStrcpy(postEvent.data, inBuf);
152 postEvent.size = ConsoleEventHeaderSize + dStrlen(inBuf) + 1;
153 Con::printf("=> %s",postEvent.data);
154 Game->postEvent(postEvent);
155 // clear the buffer
156 clearInBuf();
157 // display the prompt. Note that we're using real printf, not Con::printf...
158 printf("=> ");
159 }
160 else
161 {
162 // add it to the buffer.
163 inBuf[inBufPos++] = c;
164 // if we're full, clear & warn.
165 if(inBufPos >= MaxConsoleLineSize-1)
166 {
167 clearInBuf();
168 Con::warnf("Line to long, discarding the last 512 bytes...");
169 }
170 }
171 }
172 Con::printf("Console Input Thread Stopped");
173}

Callers 1

Calls 5

printfFunction · 0.85
warnfFunction · 0.85
dStrcpyFunction · 0.70
dStrlenFunction · 0.70
postEventMethod · 0.45

Tested by

no test coverage detected