Add cleargfxcache
console command
This commit is contained in:
parent
ed508fadd5
commit
2a1c28d7d1
@ -29,11 +29,10 @@ namespace spades {
|
|||||||
namespace gui {
|
namespace gui {
|
||||||
ConsoleScreen::ConsoleScreen(Handle<client::IRenderer> renderer,
|
ConsoleScreen::ConsoleScreen(Handle<client::IRenderer> renderer,
|
||||||
Handle<client::IAudioDevice> audioDevice,
|
Handle<client::IAudioDevice> audioDevice,
|
||||||
Handle<client::FontManager> fontManager,
|
Handle<client::FontManager> fontManager, Handle<View> subview)
|
||||||
Handle<View> subview) {
|
: renderer{renderer}, audioDevice{audioDevice}, subview{subview} {
|
||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
|
|
||||||
this->subview = subview;
|
|
||||||
renderer->Init();
|
renderer->Init();
|
||||||
|
|
||||||
helper.Set(new ConsoleHelper(this), true);
|
helper.Set(new ConsoleHelper(this), true);
|
||||||
@ -226,9 +225,11 @@ namespace spades {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr const char *CMD_HELP = "help";
|
constexpr const char *CMD_HELP = "help";
|
||||||
|
constexpr const char *CMD_CLEARGFXCACHE = "cleargfxcache";
|
||||||
|
|
||||||
std::map<std::string, std::string> const g_commands{
|
std::map<std::string, std::string> const g_commands{
|
||||||
{CMD_HELP, ": Display all available commands"},
|
{CMD_HELP, ": Display all available commands"},
|
||||||
|
{CMD_CLEARGFXCACHE, ": Clear the GFX (models and images) cache, forcing reload"},
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -236,11 +237,18 @@ namespace spades {
|
|||||||
SPADES_MARK_FUNCTION();
|
SPADES_MARK_FUNCTION();
|
||||||
if (command->GetName() == CMD_HELP) {
|
if (command->GetName() == CMD_HELP) {
|
||||||
if (command->GetNumArguments() != 0) {
|
if (command->GetNumArguments() != 0) {
|
||||||
SPLog("Usage: help (no arguments)");
|
SPLog("Usage: %s (no arguments)", CMD_HELP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
DumpAllCommands();
|
DumpAllCommands();
|
||||||
return true;
|
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);
|
return ConfigConsoleResponder::ExecCommand(command) || subview->ExecCommand(command);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,8 @@ namespace spades {
|
|||||||
private:
|
private:
|
||||||
~ConsoleScreen();
|
~ConsoleScreen();
|
||||||
|
|
||||||
|
Handle<client::IRenderer> renderer;
|
||||||
|
Handle<client::IAudioDevice> audioDevice;
|
||||||
Handle<View> subview;
|
Handle<View> subview;
|
||||||
|
|
||||||
// Scripting
|
// Scripting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user