Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
cls.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
6 #include "core.h"
7 
9 {
17  {
18  public:
20  {
21  name = "cls";
22  description = "Clears console log";
23  aliases = { "clear" };
24 
26  }
27 
28  BlamResult Execute(std::vector<std::string> arguments)
29  {
31 
32  if (root)
33  {
34  for (BlamUIWidget* widget : root->children)
35  {
36  if (widget)
37  {
38  if (widget->GetType() == BlamWidgetType::Console)
39  {
40  BlamUIWidget_Console* console = (BlamUIWidget_Console*)widget;
41  console->ClearOutput();
42  }
43  }
44  }
45  }
46  else
47  {
48  Blam::Logger::LogEvent("error in function cls: ui root was null", WSV_ERROR);
49  }
50 
51  return BlamResult::Success_OK;
52  }
53  };
54 }
ui.h
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:34
BlamUIWidget_Group
Class representing a Group widget.
Definition: ui.h:263
logger.h
Blam::UI::GetUIRoot
BLAM BlamUIWidget_Group * GetUIRoot()
Retrieves the root UI group widget.
Definition: ui.cpp:64
console.h
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:31
Blam::Resources::Console::ClearScreenCommand
Class for the cls command.
Definition: cls.hpp:16
BlamUIWidget::GetType
BlamWidgetType GetType()
Retrieves the type of this widget.
Definition: BlamUIWidget.cpp:207
Blam::Resources::Console::ClearScreenCommand::ClearScreenCommand
ClearScreenCommand()
Definition: cls.hpp:19
BlamUIWidget_Group::children
std::vector< BlamUIWidget * > children
The list of child widgets within this group.
Definition: ui.h:270
BlamWidgetType::Console
@ Console
Special widget. Used for the in-game console.
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:33
BlamUIWidget_Console::ClearOutput
void ClearOutput()
Clears the console output.
Definition: BlamUIWidget_Console.cpp:735
BlamUIWidget
Base class for a UI widget.
Definition: ui.h:87
Blam::Resources::Console::ClearScreenCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: cls.hpp:28
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:38
BlamUIWidget_Console
Class for the console UI widget.
Definition: console.h:48
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:36
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5