Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
debug_menu_rebuild.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
6 
8 {
16  {
17  public:
19  {
20  name = "debug_menu_rebuild";
21  description = "Reloads debug_menu_init.xml and rebuilds the debug menu contents";
22  aliases = { "regenerate_debug_menu", "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  {
52  }
53  else
54  {
55  Blam::Logger::LogEventForce("failed to regenerate debug menu, debug menu appears to be nullptr", WSV_WARNING);
56  }
57 
58  Blam::Logger::LogEventForce("debug menu reloaded, please re-open the menu", WSV_NONE);
59  }
60  else
61  {
62  Blam::Logger::LogEventForce("failed to fetch debug menu item from render stack, could not regenerate menu", WSV_ERROR);
63  }
64 
65  return BlamCommandResult::Ok;
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:59
Blam::Resources::DebugMenu::GetDebugMenu
BLAM BlamDebugMenu * GetDebugMenu()
Retrieves the debug menu data.
Definition: debug_menu.cpp:411
logger.h
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:56
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
debug_menu.hpp
BlamCommandResult
BlamCommandResult
Indicates the return state of a console command.
Definition: console.h:22
debug_menu.h
Blam::Resources::Console::RegenDebugMenuCommand::onCommand
BlamCommandResult onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: debug_menu_rebuild.hpp:32
Blam::Resources::Console::RegenDebugMenuCommand
Class for the debug_menu_rebuild command.
Definition: debug_menu_rebuild.hpp:15
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:58
Blam::Resources::Console::RegenDebugMenuCommand::~RegenDebugMenuCommand
~RegenDebugMenuCommand()
Definition: debug_menu_rebuild.hpp:27
BlamDebugMenu::items
std::vector< BlamDebugMenuItem > items
The list of items within the debug menu.
Definition: debug_menu.h:102
Blam::Resources::DebugMenu::ReloadDebugMenu
BLAM void ReloadDebugMenu()
Clears all existing data for the debug menu and reloads it from the file.
Definition: debug_menu.cpp:405
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:63
BlamDebugMenu::title
std::string title
The title of the main page of the debug menu. Defaults to Main.
Definition: debug_menu.h:101
BlamRendering::RenderStack::DebugMenu::BuildMenuList
void BuildMenuList(std::vector< BlamDebugMenuItem > item_list, std::string menu_title)
Rebuilds the menu contents.
Definition: debug_menu.hpp:470
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::RegenDebugMenuCommand::RegenDebugMenuCommand
RegenDebugMenuCommand()
Definition: debug_menu_rebuild.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:61
BlamRendering::RenderStack::DebugMenu::visible
bool visible
Whether or not the menu should be displayed.
Definition: debug_menu.hpp:63
BlamCommandResult::Ok
@ Ok
The command was run without error.
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