Blamite Game Engine - Blam (Core)
regenerate_debug_menu.hpp
Go to the documentation of this file.
1 #include "../console.h"
5 
6 namespace Blam::Console
7 {
15  {
16  public:
18  {
19  name = "regenerate_debug_menu";
20  description = "Reloads debug_menu_init.xml and rebuilds the debug menu contents";
21  aliases = { "regendebugmenu", "reloadmenu", "rdm" };
22 
24  }
25 
27  {
28  delete this;
29  }
30 
31  CommandStatus onCommand(std::vector<std::string> arguments)
32  {
33  using namespace BlamRendering::RenderStack;
34 
36 
37  StackObjectBase* stack_item = GetStackItem("debug_menu");
38 
39  if (stack_item)
40  {
42 
43  if (debug_menu_item->visible == true)
44  {
45  debug_menu_item->toggleVisibility();
46  }
47 
49  Blam::Logger::LogEventForce("debug menu reloaded, please re-open the menu", WSV_NONE);
50  }
51  else
52  {
53  Blam::Logger::LogEventForce("failed to fetch debug menu item from render stack, could not regenerate menu", WSV_ERROR);
54  }
55 
56  return CommandStatus::Ok;
57  }
58  };
59 }
Blam::Console::ConsoleCommand::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:75
Blam::DebugMenu::GetDebugMenu
BLAM Menu GetDebugMenu()
Retrieves the debug menu data.
Definition: debug_menu.cpp:26
Blam::Console::ConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
Blam::Console::ConsoleCommand::type
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
Blam::DebugMenu::Menu::title
std::string title
The title of the main page of the debug menu. Defaults to Main.
Definition: blam_ui.h:114
Blam::DebugMenu::ReloadDebugMenu
BLAM void ReloadDebugMenu()
Clears all existing data for the debug menu and reloads it from the file.
Definition: debug_menu.cpp:356
Blam::Console::CommandStatus
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
logger.h
BlamRendering::RenderStack
Namespace containing things relating to the Render Stack.
Definition: drawing.h:14
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
BlamRendering::RenderStack::DebugMenu
Stack item representing the debug menu.
Definition: debug_menu.hpp:20
BlamRendering::RenderStack::DebugMenu::toggleVisibility
void toggleVisibility()
Toggles the visibility of the debug menu.
Definition: debug_menu.hpp:602
WSV_ERROR
#define WSV_ERROR
Macro for 'Error' log seveirty. Original pre-enum value was 2.
Definition: logger.h:17
Blam::DebugMenu::Menu::items
std::vector< MenuItem > items
The list of items within the debug menu.
Definition: blam_ui.h:116
Blam::Console::RegenDebugMenuCommand::RegenDebugMenuCommand
RegenDebugMenuCommand()
Definition: regenerate_debug_menu.hpp:17
debug_menu.hpp
Blam::Console::RegenDebugMenuCommand::~RegenDebugMenuCommand
~RegenDebugMenuCommand()
Definition: regenerate_debug_menu.hpp:26
WSV_NONE
#define WSV_NONE
Macro for 'None' log seveirty. Original pre-enum value was 0.
Definition: logger.h:15
Blam::Console::RegenDebugMenuCommand
Class for the regenerate_debug_menu command.
Definition: regenerate_debug_menu.hpp:14
BlamRendering::RenderStack::DebugMenu::BuildMenuList
void BuildMenuList(std::vector< Blam::DebugMenu::MenuItem > item_list, std::string menu_title)
Rebuilds the menu contents.
Definition: debug_menu.hpp:470
blam_ui.h
Blam::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Console::Ok
@ Ok
The command was run without error.
Definition: console.h:30
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
BlamRendering::RenderStack::StackObjectBase
Base class for all render stack objects.
Definition: render_stack.h:194
BlamRendering::RenderStack::DebugMenu::visible
bool visible
Whether or not the menu should be displayed.
Definition: debug_menu.hpp:63
Blam::Console::RegenDebugMenuCommand::onCommand
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: regenerate_debug_menu.hpp:31
BlamRendering::RenderStack::GetStackItem
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition: render_stack.cpp:75