59 std::cout << color <<
prompt << reset;
69 std::this_thread::sleep_for(std::chrono::milliseconds(delay));
87 std::this_thread::sleep_for(std::chrono::milliseconds(delay));
97 std::this_thread::sleep_for(std::chrono::milliseconds(delay));
115 Report(
"\nWelcome to Virtual Manager\n",
"cyan");
131 if (text.size() > 0 && echo ==
true)
156 std::this_thread::sleep_for(std::chrono::milliseconds(1));
172 std::string commandline =
buffer;
173 int pos = commandline.find(
" ", 0);
179 command = commandline.substr(0, pos);
186 command = commandline;
189 if (command ==
"shutdown")
191 if (params.size() != 1)
192 Report (
"Incorrect number of parameters");
195 if (params[0] ==
"all")
211 if (command ==
"setactive")
213 if (params.size() != 1)
214 Report(
"Incorrect number of parameters");
223 if (command ==
"reload")
225 if (params.size() == 0)
232 else if (params[0] ==
"all")
255 if (command ==
"vmload")
257 if (params.size() != 1)
258 Report(
"Incorrect number of parameters");
260 vm->
Load(
false, params[0]);
267 if (command ==
"switch")
269 if (params.size() != 1)
270 Report(
"Incorrect number of parameters");
279 if (command ==
"version")
293 if (command ==
"arch")
302 if (command ==
"platform")
311 if (command ==
"uname")
313 if (params.size() > 0)
323 if (command ==
"start")
325 vm->
Load(
false,
"Ground.bld");
336 for (
int i = 0; i < count; i++)
339 Real elapsed_time = 0;
351 if (command ==
"date")
354 time_t timestamp = time(0);
355 struct tm datetime = *localtime(×tamp);
356 Report(asctime(&datetime));
366 Report(
"Simulator time: ");
367 int year, month, day, hour, minute, second;
371 sky->
GetDate(year, month, day);
372 sky->
GetTime(hour, minute, second);
381 month_s =
"February";
402 month_s =
"September";
408 month_s =
"November";
411 month_s =
"December";
415 std::string pm =
"am";
425 Report(
"No sky system loaded");
433 if (command ==
"uptime")
437 if (params.size() == 0)
455 if (command ==
"vmuptime")
457 unsigned long uptime =
vm->
Uptime() / 1000;
466 if (command ==
"profile")
470 if (params.size() == 1)
472 if (params[0] ==
"-a")
484 if (command ==
"vminit")
494 if (command ==
"boot")
512 if (params.size() == 1)
526 if (command ==
"help" || command ==
"?")
528 if (params.size() == 0)
531 Report(
"shutdown engine_number|all - shuts down the specified engine");
532 Report(
"setactive engine_number - makes the specified engine active");
533 Report(
"reload [all] - reload the current engine or all engines");
534 Report(
"vmload filename - load building data file");
535 Report(
"switch engine_number - switch to the specified engine");
536 Report(
"version - print versions");
537 Report(
"arch - print machine architecture");
538 Report(
"platform - print platform information");
539 Report(
"uname - print VM name and version");
540 Report(
"start - start simulator with a ground scene");
541 Report(
"ps - show engine process list");
542 Report(
"date - show real and simulator date and time");
543 Report(
"uptime [engine_number] - show the SBS engine uptime in seconds");
544 Report(
"vmuptime - show uptime of VM in seconds");
545 Report(
"profile [-a] - shows function-level profiling statistics");
546 Report(
"vminit - create and initialize a simulator engine");
547 Report(
"boot [engine_number] - start a simulator engine");
548 Report(
"help - print this help guide\n");
549 Report(
"All other commands will be passed to the active simulator engine, if available");
553 Report(
"\nPress CTRL-c to quit");
569 Report(
"No active engine");
612 else if (color ==
"green")
614 else if (color ==
"yellow")
616 else if (color ==
"red")
618 else if (color ==
"magenta")
620 else if (color ==
"cyan")
622 else if (color ==
"white")
624 else if (color ==
"black")
626 else if (color ==
"reset")
static void dumpAll(std::string &output)
static void CleanupMemory(void)
unsigned long GetRunTime()
std::string GetFilename()
void WriteToConsole(const std::string &message, const std::string &color="white")
void ConsoleOut(const std::string &message, const std::string &color="white")
bool LoadFromText(const std::string &text)
EngineContext * GetEngine()
void GetTime(int &hour, int &minute, int &second)
Caelum::CaelumSystem * GetCaelumSystem()
void GetDate(int &year, int &month, int &day)
bool ReportError(const std::string &text)
void Process(const std::string &text="", bool echo=true)
bool Report(const std::string &text, const std::string &color="cyan")
void SetActiveEngine(int number, bool switch_engines=false, bool force=false)
int GetEngineCount(bool loading_only=false)
EngineContext * Initialize(bool clear, EngineContext *parent=0, const Vector3 &position=Vector3::ZERO, Real rotation=0.0, const Vector3 &area_min=Vector3::ZERO, const Vector3 &area_max=Vector3::ZERO)
std::string version_frontend
unsigned long GetElapsedTime(int instance)
bool Load(bool clear, const std::string &filename, EngineContext *parent=0, const Vector3 &position=Vector3::ZERO, Real rotation=0.0, const Vector3 &area_min=Vector3::ZERO, const Vector3 &area_max=Vector3::ZERO)
std::string version_state
SkySystem * GetSkySystem()
ScriptProcessor * GetActiveScriptProcessor()
EngineContext * GetActiveEngine()
EngineContext * GetEngine(int number)
std::vector< String > StringVector
bool SBSIMPEXP enable_profiling
void SplitString(std::vector< std::string > &dest_array, const std::string &original_string, char separator)
bool SBSIMPEXP enable_advanced_profiling
int ToInt(const std::string &string)
std::string ToString(int number)
void TrimString(std::string &string)
std::atomic< bool > shutdown
std::string GetColors(const std::string &color)
VMConsoleResult consoleresult
std::atomic< bool > server_ready
std::atomic< bool > ready
std::atomic< bool > threadwait