Blamite Game Engine - Blam (Core)
print.hpp
Go to the documentation of this file.
1 #include "../console.h"
3 
4 namespace Blam::Console
5 {
18  {
19  public:
21  {
22  name = "print";
23  description = "Prints a message to the screen. Supports color arguments";
24 
26  }
27 
29  {
30  delete this;
31  }
32 
33  CommandStatus onCommand(std::vector<std::string> arguments)
34  {
35  using namespace Blam::Logger;
36 
37  if (arguments.size() == 0)
38  {
40  }
41  else
42  {
43  BlamColor color;
44  color.r = 0;
45  color.g = 255;
46  color.b = 0;
47 
48  std::string message_text = "";
49 
50  for (int i = 0; i < arguments.size(); i++)
51  {
52  if (i == arguments.size() - 1)
53  {
54  message_text += arguments[i];
55  }
56  else
57  {
58  message_text += arguments[i] + " ";
59  }
60  }
61 
62  LogEventForce(message_text, color);
63 
64  return CMD_OK;
65  }
66  }
67  };
68 }
Blam::Console::ConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
CMD_ERR_WRONG_ARGS_COUNT
#define CMD_ERR_WRONG_ARGS_COUNT
Macro for Wrong Arg Count command status. See Blam::Console::WrongArgumentCount for more details.
Definition: console.h:11
Blam::Console::ConsoleCommand::type
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
Blam::Console::CommandStatus
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
logger.h
BlamColor::g
short g
The Green value of the color.
Definition: colors.h:22
Blam::Console::PrintCommand::~PrintCommand
~PrintCommand()
Definition: print.hpp:28
Blam::Console::Builtin
@ Builtin
A command that is hard-coded into the engine.
Definition: console.h:41
Blam::Console::ConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:70
BlamColor::r
short r
The Red value of the color.
Definition: colors.h:21
Blam::Console::PrintCommand
Class for the print command.
Definition: print.hpp:17
BlamColor::b
short b
The Blue value of the color.
Definition: colors.h:23
Blam::Console::PrintCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: print.hpp:33
Blam::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Console::ConsoleCommand
Class used to represent a console command.
Definition: console.h:50
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message, LogSeverity severity)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:137
CMD_OK
#define CMD_OK
Macro for OK command status. See Blam::Console::Ok for more details.
Definition: console.h:9
Blam::Console::PrintCommand::PrintCommand
PrintCommand()
Definition: print.hpp:20
Blam::Logger
Namespace containing things related to the Blamite Logger.
Definition: logger.h:44
BlamColor
Structure representing a color.
Definition: colors.h:18