Cleaned up main.cpp

Added functionality to send Lua scripts over the network
This commit is contained in:
Alexander Bock
2014-09-17 01:10:52 +02:00
parent 03e25f69d5
commit 8ec9bc6705
3 changed files with 37 additions and 22 deletions

View File

@@ -585,4 +585,24 @@ void OpenSpaceEngine::decode()
#endif
}
void OpenSpaceEngine::externalControlCallback(const char* receivedChars,
int size, int clientId)
{
if (size == 0)
return;
// The first byte determines the type of message
const char type = receivedChars[0];
switch (type) {
case '0': // LuaScript
{
std::string script = std::string(receivedChars + 1);
LINFO("Received Lua Script: '" << script << "'");
_scriptEngine->runScript(script);
}
}
}
} // namespace openspace