Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
regenerate_debug_menu.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
6 
8 {
16  {
17  public:
19  {
20  name = "regenerate_debug_menu";
21  description = "Reloads debug_menu_init.xml and rebuilds the debug menu contents";
22  aliases = { "regendebugmenu", "reloadmenu", "rdm" };
23 
25  }
26 
28  {
29  delete this;
30  }
31 
32  BlamCommandResult onCommand(std::vector<std::string> arguments)
33  {
34  using namespace BlamRendering::RenderStack;
35 
37 
38  StackObjectBase* stack_item = GetStackItem("debug_menu");
39 
40  if (stack_item)
41  {
43 
44  if (debug_menu_item->visible == true)
45  {
46  debug_menu_item->toggleVisibility();
47  }
48 
50  Blam::Logger::LogEventForce("debug menu reloaded, please re-open the menu", WSV_NONE);
51  }
52  else
53  {
54  Blam::Logger::LogEventForce("failed to fetch debug menu item from render stack, could not regenerate menu", WSV_ERROR);
55  }
56 
57  return BlamCommandResult::Ok;
58  }
59  };
60 }
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:57
logger.h
BlamCommandResult::Ok
@ Ok
The command was run without error.
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:54
BlamRendering::RenderStack
Namespace containing things relating to the Render Stack.
Definition: drawing.h:14
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
debug_menu.h
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message, BlamLogLevel severity)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:218
debug_menu.hpp
Blam::Resources::Console::RegenDebugMenuCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: regenerate_debug_menu.hpp:32
Blam::Resources::Console::RegenDebugMenuCommand
Class for the regenerate_debug_menu command.
Definition: regenerate_debug_menu.hpp:15
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:56
WSV_NONE
#define WSV_NONE
Macro for 'None' log seveirty. Original pre-enum value was 0.
Definition: logger.h:16
Blam::Resources::Console::RegenDebugMenuCommand::~RegenDebugMenuCommand
~RegenDebugMenuCommand()
Definition: regenerate_debug_menu.hpp:27
BlamDebugMenu::items
std::vector< BlamDebugMenuItem > items
The list of items within the debug menu.
Definition: debug_menu.h:100
Blam::Resources::DebugMenu::ReloadDebugMenu
BLAM void ReloadDebugMenu()
Reloads debug menu content from debug_menu_init.xml.
Definition: debug_menu.cpp:355
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:61
BlamDebugMenu::title
std::string title
The title of the main page of the debug menu. Defaults to Main.
Definition: debug_menu.h:99
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
BlamRendering::RenderStack::DebugMenu::BuildMenuList
void BuildMenuList(std::vector< BlamDebugMenuItem > item_list, std::string menu_title)
Rebuilds the menu contents.
Definition: debug_menu.hpp:470
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
Blam::Resources::Console::RegenDebugMenuCommand::RegenDebugMenuCommand
RegenDebugMenuCommand()
Definition: regenerate_debug_menu.hpp:18
BlamRendering::RenderStack::StackObjectBase
Base class for all render stack objects.
Definition: render_stack.h:194
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:59
BlamRendering::RenderStack::DebugMenu::visible
bool visible
Whether or not the menu should be displayed.
Definition: debug_menu.hpp:63
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
BlamRendering::RenderStack::GetStackItem
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition: render_stack.cpp:75
Blam::Resources::DebugMenu::GetDebugMenu
BLAM BlamDebugMenu GetDebugMenu()
Retrieves the debug menu data.
Definition: debug_menu.cpp:25