Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
cls.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
5 #include "core.h"
6 
8 {
16  {
17  public:
19  {
20  name = "cls";
21  description = "Clears console log";
22  aliases = { "clear" };
23 
25  }
26 
28  {
29  delete this;
30  }
31 
32  BlamCommandResult onCommand(std::vector<std::string> arguments)
33  {
34  using namespace BlamRendering::RenderStack;
35 
36  StackObjectBase* stack_item = (StackObjectBase*)GetStackItem("console");
37 
38  if (stack_item)
39  {
40  if (stack_item->type_label == STACKTYPE_CONSOLE)
41  {
42  ConsoleUI* console = (ConsoleUI*)stack_item;
43 
44  console->clearScrollback();
45  }
46  else
47  {
48  Blam::Logger::LogEvent("failed to retrieve console ui stack object (got wrong stack type)", WSV_ERROR);
49  }
50  }
51  else
52  {
53  Blam::Logger::LogEvent("failed to retrieve console ui stack object (GetStackItem returned nullptr)", WSV_ERROR);
54  }
55 
56  return BlamCommandResult::Ok;
57  }
58  };
59 }
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:101
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:57
logger.h
Blam::Resources::Console::ClearScreenCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: cls.hpp:32
BlamCommandResult::Ok
@ Ok
The command was run without error.
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:54
Blam::Resources::Console::ClearScreenCommand
Class for the cls command.
Definition: cls.hpp:15
BlamRendering::RenderStack::StackObjectBase::type_label
StackType type_label
The type of the object.
Definition: render_stack.h:372
BlamRendering::RenderStack
Namespace containing things relating to the Render Stack.
Definition: drawing.h:14
Blam::Resources::Console::ClearScreenCommand::ClearScreenCommand
ClearScreenCommand()
Definition: cls.hpp:18
WSV_ERROR
#define WSV_ERROR
Macro for 'Error' log seveirty. Original pre-enum value was 2.
Definition: logger.h:17
Blam::Resources::Console::ClearScreenCommand::~ClearScreenCommand
~ClearScreenCommand()
Definition: cls.hpp:27
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:56
STACKTYPE_CONSOLE
#define STACKTYPE_CONSOLE
Definition: render_stack.h:26
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:61
BlamRendering::RenderStack::ConsoleUI::clearScrollback
void clearScrollback()
Definition: console.hpp:423
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
core.h
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
BlamRendering::RenderStack::StackObjectBase
Base class for all render stack objects.
Definition: render_stack.h:194
BlamConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:59
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
BlamRendering::RenderStack::GetStackItem
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition: render_stack.cpp:75
BlamRendering::RenderStack::ConsoleUI
Definition: console.hpp:66
console.hpp