Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
h2print.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
4 
6 {
18  {
19  public:
21  {
22  name = "old_print";
23  description = "Prints a message to the screen. Color overrides are not supported.";
24  aliases = { "h2print", "cprint" };
25 
27  }
28 
29  BlamResult Execute(std::vector<std::string> arguments)
30  {
31  if (arguments.size() == 0)
32  {
33  return BlamResult::Error_Command_WrongArgumentCount;
34  }
35 
36  std::string message_text = "";
37 
38  for (int i = 0; i < arguments.size(); i++)
39  {
40  if (i == arguments.size() - 1)
41  {
42  message_text += arguments[i];
43  }
44  else
45  {
46  message_text += arguments[i] + " ";
47  }
48  }
49 
50  if (arguments.size() == 1 || (message_text.starts_with("\"") && message_text.ends_with("\"")))
51  {
52  // valid
53 
54  if (message_text.starts_with("\"") && message_text.ends_with("\""))
55  {
56  message_text = message_text.substr(1, message_text.length() - 2);
57  }
58 
59  Blam::Logger::LogEventForce(BlamStrings::Utils::String::ToLower(arguments[0]), BlamColor(0, 255, 0));
60  return BlamResult::Success_OK;
61  }
62  else
63  {
64  return BlamResult::Error_Command_WrongArgumentCount;
65  }
66  }
67  };
68 }
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:34
Blam::Resources::Console::Halo2PrintCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: h2print.hpp:29
logger.h
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:31
Blam::Resources::Console::Halo2PrintCommand
Class for the h2print command.
Definition: h2print.hpp:17
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:33
Blam::Resources::Console::Halo2PrintCommand::Halo2PrintCommand
Halo2PrintCommand()
Definition: h2print.hpp:20
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:38
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
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