Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
console.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <map>
5 #include <vector>
6 #include <Windows.h>
7 
8 #define CMD_OK BlamCommandResult::Ok;
9 #define CMD_ERR_INVALID_ARGS BlamCommandResult::InvalidArguments;
10 #define CMD_ERR_WRONG_ARGS_COUNT BlamCommandResult::WrongArgumentCount;
11 
12 #ifndef BLAM
13 #define BLAM
14 #endif
15 
23 {
24  Ok,
28 };
29 
33 enum class BlamCommandType
34 {
35  Builtin,
36  Script,
37 
43  Global,
44  Other
45 };
46 
57 {
58  std::string name;
59  std::string description;
60  std::string syntax;
61  std::vector<std::string> aliases;
62 
64 
72  virtual BlamCommandResult onCommand(std::vector<std::string> arguments) { return BlamCommandResult::Ok; };
73 };
74 
79 {
83  namespace Handlers
84  {
97  BLAM BlamCommandResult BooleanHandler(bool* value, std::vector<std::string> arguments, BlamConsoleCommand* command);
98  }
99 
107  BLAM std::string RegisterCommand(BlamConsoleCommand* command);
108 
116  BLAM void UnregisterCommand(std::string name);
117 
125  BLAM BlamConsoleCommand* GetCommand(std::string name);
126 
134  BLAM HRESULT RunCommandLine(std::string command_line);
135 
144  BLAM std::map<std::string, BlamConsoleCommand*> GetCommandList();
145 
150 
154  BLAM void Cleanup();
155 }
DisplayCommandError
void DisplayCommandError(BlamCommandResult error_code, BlamConsoleCommand *command)
Displays an error message to inform the user why a command failed to run.
Definition: console.cpp:56
command_list
std::map< std::string, BlamConsoleCommand * > command_list
The list of all loaded console commands.
Definition: console.cpp:48
Blam::Resources::Console::VersionCommand
Class for the version command.
Definition: version.hpp:18
Blam::Resources::Console::UnregisterCommand
BLAM void UnregisterCommand(std::string name)
Unregisters the console command with the specified name.
Definition: console.cpp:231
Blam::Resources::Console::RegisterBuiltinCommands
BLAM void RegisterBuiltinCommands()
Registers all hard-coded engine commands.
Definition: console.cpp:374
Blam::Resources::Console::HistoryCommand
Class for the history command.
Definition: history.hpp:14
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
abort.hpp
drop.hpp
Blam::Globals::GetGlobal
BLAM EngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: globals.cpp:193
Blam::Resources::Console::NoUCommand
Class for the nou command.
Definition: nou.hpp:13
script_doc.hpp
Blam::Resources::Console::Handlers::BooleanHandler
BLAM BlamCommandResult BooleanHandler(bool *value, std::vector< std::string > arguments, BlamConsoleCommand *command)
Handler for boolean commands.
Definition: command_handlers.cpp:11
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:59
Blam::Resources::Console::ScreenshotCommand
Class for the screenshot command.
Definition: screenshot.hpp:13
Blam::Resources::Console::Win32DialogTestCommand
Class for the win32_dialog_test command.
Definition: win32_dialog_test.hpp:13
Blam::Globals::UnknownGlobal
@ UnknownGlobal
The specified global does not exist.
Definition: globals.h:31
Blam::Globals::GlobalIsProtected
@ GlobalIsProtected
The specified global is protected and cannot be modified during runtime.
Definition: globals.h:35
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:56
Blam::Resources::Console::ClearScreenCommand
Class for the cls command.
Definition: cls.hpp:17
Blam::Config::GetConfig
BLAM ConfigFile * GetConfig()
Retrieves the engine configuration file.
Definition: compat.cpp:5
Blam::Resources::Console::ListenerBugCheckCommand
Class for the listener_bug_check command.
Definition: listener_bug_check.hpp:17
Blam::Globals::InvalidArgs
@ InvalidArgs
The provided arguments were invalid.
Definition: globals.h:33
BlamCommandType::Other
@ Other
Currently unused.
Blam::Globals::UpdateGlobalWrap
BLAM GvarUpdateResult UpdateGlobalWrap(std::string name, std::string new_value)
Updates a global's raw value.
Definition: globals.cpp:435
engine_text.h
Blam::Resources::Console::CrashCommand
Class for the crash command.
Definition: crash.hpp:14
version.hpp
open_web_url.hpp
display_global_update_message
void display_global_update_message(Blam::Globals::GvarUpdateResult error_code, Blam::Globals::EngineGlobal *global)
Displays an error message to inform the user why a global variable failed to update.
Definition: console.cpp:100
console.h
Blam::Globals::EngineGlobal::name
std::string name
The name of the global.
Definition: globals.h:67
screenshot.hpp
Blam::Resources::Console::Halo2PrintCommand
Class for the h2print command.
Definition: h2print.hpp:17
Blam::Resources::Console::ShowStatsCommand
Class for the show_stats command.
Definition: show_stats.hpp:16
nou.hpp
BlamCommandType::Global
@ Global
A command that is used to modify a global.
Blam::Resources::Console::GetCommand
BLAM BlamConsoleCommand * GetCommand(std::string name)
Retrieves a command with the specified name.
Definition: console.cpp:243
Blam::Resources::Console::ClassifyCommand
Class for the classify command.
Definition: classify.hpp:14
Blam::Resources::Console::Halo2HelpCommand
Class for the h2help command.
Definition: h2help.hpp:18
Blam::Globals::String
@ String
Represents a std::string.
Definition: globals.h:48
Blam::Resources::Console::ToggleImguiWindowCommand
Class for the toggle_imgui_window command.
Definition: toggle_imgui_window.hpp:12
BlamConsoleCommand::onCommand
virtual BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: console.h:72
Blam::Resources::Console::QuitCommand
Class for the quit command.
Definition: quit.hpp:13
classify.hpp
Blam::Resources::Console::TagLoadForceCommand
Class for the tag_load_force command.
Definition: tag_load_force.hpp:17
Blam::Resources::Console::DropCommand
Class for the drop command.
Definition: drop.hpp:14
Blam::Globals::EngineGlobal
Structure containing data for a game engine global.
Definition: globals.h:64
listener_bug_check.hpp
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
dx_render_target_clear.hpp
h2print.hpp
show_stats.hpp
Blam::Resources::Console::RunCommandLine
BLAM HRESULT RunCommandLine(std::string command_line)
Executed the provided string as a console command.
Definition: console.cpp:271
Blam::Resources::Console::ExploreCommand
Class for the explore command.
Definition: explore.hpp:18
Blam::Resources::Console::DXRenderTargetClearCommand
Class for the dx_render_target_clear command.
Definition: dx_render_target_clear.hpp:14
Blam::Resources::Console::AbortCommand
Class for the abort command.
Definition: abort.hpp:12
Blam::Resources::Console::TagFieldSizesCommand
Class for the tag_field_sizes command.
Definition: tag_field_sizes.hpp:15
Blam::Resources::Console::RegenDebugMenuCommand
Class for the debug_menu_rebuild command.
Definition: debug_menu_rebuild.hpp:15
generate_plugins.hpp
explore.hpp
BLAM
#define BLAM
Definition: console.h:13
Blam::Resources::Console::GeneratePluginsCommand
Class for the generate_plugins command.
Definition: generate_plugins.hpp:14
console_update_global
void console_update_global(std::string global_name, std::vector< std::string > arguments)
Definition: console.cpp:179
Blam::Globals::GvarUpdateResult
GvarUpdateResult
Enumerator for the result of a global update attempt.
Definition: globals.h:28
Blam::Settings::Paths::ParseFolderPlaceholders
BLAM std::string ParseFolderPlaceholders(std::string string)
Parses any engine/user data folder placeholders within a string.
Definition: paths.cpp:382
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:58
map_name.hpp
BlamCommandResult::Unsupported
@ Unsupported
The command is a legacy command from the original ImGUI-based console that is no longer supported.
Blam::Resources::Console::MapNameCommand
Class for the map_name command.
Definition: map_name.hpp:18
Blam::Globals::InvalidType
@ InvalidType
The provided value was of an invalid type.
Definition: globals.h:30
it
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font or adding deleting some characters in from glyph table PL means Public License Copyright Holder means whoever is named in the copyright or copyrights for the Font You means the or person redistributing or modifying the Font Freely Available means that you have the freedom to copy or modify the Font as well as redistribute copies of the Font under the same conditions you not price If you you can charge for this service Copying &Distribution You may copy and distribute verbatim copies of this Font in any without provided that you retain this license including modifying reordering converting changing font or adding deleting some characters in from glyph and copy and distribute such modifications under the terms of Section provided that the following conditions are such as by offering access to copy the modifications from a designated or distributing the modifications on a medium customarily used for software interchange c If the modified fonts normally reads commands interactively when you must cause it
Definition: ARPHICPL.TXT:36
Blam::Resources::Console::ListColorsCommand
Class for the list_colors command.
Definition: list_colors.hpp:16
cls.hpp
Blam::Resources::Console::GetCommandList
BLAM std::map< std::string, BlamConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:237
Blam::Resources::Console::ScriptDocCommand
Class for the script_doc command.
Definition: script_doc.hpp:14
Blam::Globals::OutOfBounds
@ OutOfBounds
The provided value was too small or too large for the globals' data type.
Definition: globals.h:34
reload_material_datablocks.hpp
toggle_imgui_window.hpp
Blam::Resources::Console::SentryTestCommand
A command to test Sentry functionality.
Definition: sentry_test.hpp:12
Blam::Resources::Console::ListLevelsCommand
Class for the list_levels command.
Definition: list_levels.hpp:17
Blam::Resources::Console::PrintCommand
Class for the print command.
Definition: print.hpp:18
BlamConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:60
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:63
list_levels.hpp
BlamCommandType::Script
@ Script
A command that originates from a BlamScript.
BlamCommandResult::InvalidArguments
@ InvalidArguments
Invalid arguments (or argument types) were specified - such as providing a string in place of an int.
ENGINE_TEXT
#define ENGINE_TEXT(string_id)
Definition: engine_text.h:7
value
Offset font vertically by altering the io Font DisplayOffset value
Definition: README.txt:67
win32_dialog_test.hpp
open_game_dir.hpp
list_colors.hpp
resolution.hpp
help.hpp
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:274
Blam::Resources::Console::ResolutionCommand
Class for the screenres command.
Definition: resolution.hpp:14
history.hpp
quit.hpp
Blam::Globals::EngineGlobal::value_raw
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:69
BlamCommandType
BlamCommandType
Used to indicate the type of command.
Definition: console.h:33
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:61
crash.hpp
BlamCommandResult::WrongArgumentCount
@ WrongArgumentCount
Too few or too many arguments were provided.
Blam::Resources::Console::ReloadMaterialDatablocksCommand
Class for the cls command.
Definition: reload_material_datablocks.hpp:17
print.hpp
sentry_test.hpp
debug_menu_rebuild.hpp
Blam::Resources::Console::CreateCommandObjectCommand
Class for the create_cmd_obj command.
Definition: create_cmd_obj.hpp:17
h2help.hpp
tag_field_sizes.hpp
Blam::Globals::EngineGlobal::type
GvarType type
The type of the global.
Definition: globals.h:66
tag_load_force.hpp
BlamCommandResult::Ok
@ Ok
The command was run without error.
create_cmd_obj.hpp
Blam::Resources::Console::OpenWebURLCommand
Class for the open_web_url command.
Definition: open_web_url.hpp:14
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Resources::Console::Cleanup
BLAM void Cleanup()
Cleans up all console command data.
Definition: console.cpp:363
Blam::Resources::Console::HelpCommand
Class for the help command.
Definition: help.hpp:16
name
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font name
Definition: ARPHICPL.TXT:16
Blam::Globals::UpdateGlobal
BLAM GvarUpdateResult UpdateGlobal(std::string name, std::string new_value)
Updates the value of a String global.
Definition: globals.cpp:578
Blam::Globals::GetGvarTypeLabel
BLAM std::string GetGvarTypeLabel(GvarType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: globals.cpp:40
Blam::Resources::Console::OpenGameDirectoryCommand
Class for the open_game_dir command.
Definition: open_game_dir.hpp:13
Blam::Resources::Console::RegisterCommand
BLAM std::string RegisterCommand(BlamConsoleCommand *command)
Register a new command object.
Definition: console.cpp:223