Add cleargfxcache console command

This commit is contained in:
yvt 2019-07-14 23:58:46 +09:00
parent ed508fadd5
commit 2a1c28d7d1
No known key found for this signature in database
GPG Key ID: 48F2768FA8D07C92
2 changed files with 14 additions and 4 deletions

View File

@ -29,11 +29,10 @@ namespace spades {
namespace gui {
ConsoleScreen::ConsoleScreen(Handle<client::IRenderer> renderer,
Handle<client::IAudioDevice> audioDevice,
Handle<client::FontManager> fontManager,
Handle<View> subview) {
Handle<client::FontManager> fontManager, Handle<View> subview)
: renderer{renderer}, audioDevice{audioDevice}, subview{subview} {
SPADES_MARK_FUNCTION();
this->subview = subview;
renderer->Init();
helper.Set(new ConsoleHelper(this), true);
@ -226,9 +225,11 @@ namespace spades {
namespace {
constexpr const char *CMD_HELP = "help";
constexpr const char *CMD_CLEARGFXCACHE = "cleargfxcache";
std::map<std::string, std::string> const g_commands{
{CMD_HELP, ": Display all available commands"},
{CMD_CLEARGFXCACHE, ": Clear the GFX (models and images) cache, forcing reload"},
};
} // namespace
@ -236,11 +237,18 @@ namespace spades {
SPADES_MARK_FUNCTION();
if (command->GetName() == CMD_HELP) {
if (command->GetNumArguments() != 0) {
SPLog("Usage: help (no arguments)");
SPLog("Usage: %s (no arguments)", CMD_HELP);
return true;
}
DumpAllCommands();
return true;
} else if (command->GetName() == CMD_CLEARGFXCACHE) {
if (command->GetNumArguments() != 0) {
SPLog("Usage: %s (no arguments)", CMD_CLEARGFXCACHE);
return true;
}
renderer->ClearCache();
return true;
}
return ConfigConsoleResponder::ExecCommand(command) || subview->ExecCommand(command);
}

View File

@ -60,6 +60,8 @@ namespace spades {
private:
~ConsoleScreen();
Handle<client::IRenderer> renderer;
Handle<client::IAudioDevice> audioDevice;
Handle<View> subview;
// Scripting