Adds new console methods and commands to hide/show console. Only on windows (for now?)

develop
Warmist 2014-05-26 18:29:27 +03:00
parent e4a6f13347
commit dedd7e4185
5 changed files with 41 additions and 0 deletions

@ -770,4 +770,14 @@ void Console::msleep (unsigned int msec)
{ {
if (msec > 1000) sleep(msec/1000000); if (msec > 1000) sleep(msec/1000000);
usleep((msec % 1000000) * 1000); usleep((msec % 1000000) * 1000);
}
void Console::hide()
{
//Warmist: don't know if it's possible...
}
void Console::show()
{
//Warmist: don't know if it's possible...
} }

@ -777,3 +777,13 @@ void Console::msleep (unsigned int msec)
if (msec > 1000) sleep(msec/1000000); if (msec > 1000) sleep(msec/1000000);
usleep((msec % 1000000) * 1000); usleep((msec % 1000000) * 1000);
} }
void Console::hide()
{
//Warmist: don't know if it's possible...
}
void Console::show()
{
//Warmist: don't know if it's possible...
}

@ -589,3 +589,13 @@ void Console::msleep (unsigned int msec)
{ {
Sleep(msec); Sleep(msec);
} }
void Console::hide()
{
ShowWindow( GetConsoleWindow(), SW_HIDE );
}
void Console::show()
{
ShowWindow( GetConsoleWindow(), SW_RESTORE );
}

@ -760,6 +760,14 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve
return CR_WRONG_USAGE; return CR_WRONG_USAGE;
} }
} }
else if(first=="hide")
{
getConsole().hide();
}
else if(first=="show")
{
getConsole().show();
}
else else
{ {
command_result res = plug_mgr->InvokeCommand(con, first, parts); command_result res = plug_mgr->InvokeCommand(con, first, parts);

@ -155,6 +155,9 @@ namespace DFHack
bool isInited (void) { return inited; }; bool isInited (void) { return inited; };
bool is_console() { return true; } bool is_console() { return true; }
void hide();
void show();
private: private:
Private * d; Private * d;
tthread::recursive_mutex * wlock; tthread::recursive_mutex * wlock;