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