Elaztek Developer Hub
Blamite Game Engine - blam!  00388.06.24.23.2301.blamite
The core library for the Blamite Game Engine.
debug_menu.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #define MENU_ITEM_TYPE_UNKNOWN BlamDebugMenuItemType::Unknown
7 #define MENU_ITEM_TYPE_EXEC BlamDebugMenuItemType::Command
8 #define MENU_ITEM_TYPE_CATEGORY BlamDebugMenuItemType::Submenu
9 #define MENU_ITEM_TYPE_GLOBAL BlamDebugMenuItemType::Global
10 #define MENU_ITEM_TYPE_MULTIEXEC BlamDebugMenuItemType::CommandSequence
11 
12 #define DEBUG_MENU_FILE "debug_menu_init"
13 
14 #ifndef BLAM
15 #define BLAM
16 #endif
17 
18 namespace InternalUI
19 {
20  BLAM void CreateFPSCounter();
21  BLAM void UpdateFPSCounter();
22 }
23 
28 {
29  Command,
30 
39  Global,
40  Submenu,
41  Unknown
42 };
43 
50 {
51 public:
53  std::string title;
54 
55  // Properties specific to #BlamDebugMenuItemType::Command
56 
57  std::string exec_line = "";
58 
59  // Properties specific to #BlamDebugMenuItemType::CommandSequence
60 
61  std::vector<std::string> exec_sequence = std::vector<std::string>();
63 
64  // Properties specific to #BlamDebugMenuItemType::Global
65 
66  std::string global_id = "";
67  bool use_bounds = false;
68  double inc = 1;
69  double min = 0;
70  double max = 0;
71 
72  // Properties specific to #BlamDebugMenuItemType::Submenu
73  std::vector<BlamDebugMenuItem> items;
74 
79 
83  void HandleKeyEnter();
84 
88  void HandleKeyLeft();
89 
93  void HandleKeyRight();
94 };
95 
100 {
101  std::string title;
102  std::vector<BlamDebugMenuItem> items;
103 };
104 
109 {
124  BLAM void InitializeDebugMenu();
125 
129  BLAM void ReleaseDebugMenu();
130 
134  BLAM void ReloadDebugMenu();
135 
142 }
BlamDebugMenuItem::title
std::string title
The title of the debug menu item as shown in the menu.
Definition: debug_menu.h:53
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:142
BlamEngineDataFolder::DataRoot
@ DataRoot
The root of all game engine data. Defaults to ./
Blam::Globals::GetGlobal
BLAM EngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: globals.cpp:193
Blam::Globals::EngineGlobal::float_value
float float_value
The float value of the global.
Definition: globals.h:80
BlamDebugMenuItem::exec_line
std::string exec_line
The command to run upon activation for an Executor menu item type.
Definition: debug_menu.h:57
BlamDebugMenuItem::inc
double inc
How much to add or remove from the value at a time upon activation.
Definition: debug_menu.h:68
load_menu_item
BlamResult load_menu_item(rapidxml::xml_node<> *entry_node, BlamDebugMenuItem *menu_item)
Loads data for a debug menu item from an XML node.
Definition: debug_menu.cpp:27
Blam::Globals::Int
@ Int
Represents an int.
Definition: globals.h:49
BlamDebugMenuItem::exec_sequence
std::vector< std::string > exec_sequence
The command sequence to run upon activation for an ExecSequence menu item type.
Definition: debug_menu.h:61
Blam::Resources::DebugMenu::GetDebugMenu
BLAM BlamDebugMenu * GetDebugMenu()
Retrieves the debug menu data.
Definition: debug_menu.cpp:411
logger.h
BlamDebugMenuItem::BlamDebugMenuItem
BlamDebugMenuItem()
Creates a new debug menu item.
Definition: BlamDebugMenuItem.cpp:6
Blam::Globals::Long
@ Long
Represents a long.
Definition: globals.h:46
Blam::Globals
Namespace containing things relating to game engine globals.
Definition: globals.h:23
BlamDebugMenuItem::current_exec_index
int current_exec_index
The index of the next item to run within the execution sequence.
Definition: debug_menu.h:62
BlamDebugMenuItem::HandleKeyLeft
void HandleKeyLeft()
Called when the menu item is active and the left arrow key is pressed.
Definition: BlamDebugMenuItem.cpp:41
DEBUG_MENU_FILE
#define DEBUG_MENU_FILE
The file name to load the debug menu contents from - without the extension.
Definition: debug_menu.h:12
USER_DATA_PATH
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:43
BlamDebugMenuItemType::Submenu
@ Submenu
Enters into a submenu/subscreen upon activation.
BlamDebugMenuItem::items
std::vector< BlamDebugMenuItem > items
The contents of the submenu to show upon activation.
Definition: debug_menu.h:73
console.h
Blam::Globals::EngineGlobal::read_only
bool read_only
Whether or not the global is protected from modification.
Definition: globals.h:70
Blam::Globals::EngineGlobal::short_value
short short_value
The short value of the global.
Definition: globals.h:77
debug_menu.h
BlamCommandType::Global
@ Global
A command that is used to modify a global.
Blam::Resources::DebugMenu::InitializeDebugMenu
BLAM void InitializeDebugMenu()
Initializes the debug menu.
Definition: debug_menu.cpp:309
Float
@ Float
Definition: render_model.h:12
errors.h
Blam::Resources::DebugMenu
Namespace containing data for the engine's debug menu.
Definition: debug_menu.h:108
Blam::Globals::EngineGlobal
Structure containing data for a game engine global.
Definition: globals.h:64
MENU_ITEM_TYPE_CATEGORY
#define MENU_ITEM_TYPE_CATEGORY
Macro for Submenu. See #Blam::Resources::DebugMenu::Submenu for details.
Definition: debug_menu.h:8
BlamDebugMenuItemType
BlamDebugMenuItemType
Menu item type enumerator.
Definition: debug_menu.h:27
globals.h
InternalUI::CreateFPSCounter
BLAM void CreateFPSCounter()
ENGINE_DATA_PATH
#define ENGINE_DATA_PATH(path)
Macro to quickly access a game engine data folder.
Definition: config.h:36
BlamDebugMenuItem::HandleKeyRight
void HandleKeyRight()
Called when the menu item is active and the right arrow key is pressed.
Definition: BlamDebugMenuItem.cpp:168
Blam::Resources::Console::RunCommandLine
BLAM HRESULT RunCommandLine(std::string command_line)
Executed the provided string as a console command.
Definition: console.cpp:271
MENU_ITEM_TYPE_MULTIEXEC
#define MENU_ITEM_TYPE_MULTIEXEC
Macro for ExecSequence. See #Blam::Resources::DebugMenu::ExecSequence for details.
Definition: debug_menu.h:10
Blam::Globals::EngineGlobal::long_value
long long_value
The long value of the global.
Definition: globals.h:78
BlamDebugMenuItem::item_type
BlamDebugMenuItemType item_type
The type of menu item. See BlamDebugMenuItemType for details.
Definition: debug_menu.h:52
BlamDebugMenuItem
Class used to store data and functions relating to an item within the engine's debug menu.
Definition: debug_menu.h:49
Blam::Globals::Short
@ Short
Represents a short.
Definition: globals.h:45
Blam::Globals::EngineGlobal::int_value
int int_value
The int value of the global.
Definition: globals.h:79
BlamEngineDataFolder::DefaultConfigs
@ DefaultConfigs
Directory containing default configuration files. Defaults to ./content/blam/default_configs/
BlamDebugMenu::items
std::vector< BlamDebugMenuItem > items
The list of items within the debug menu.
Definition: debug_menu.h:102
BlamDebugMenuItem::global_id
std::string global_id
The ID of the engine global to modify upon activation.
Definition: debug_menu.h:66
main_menu
BlamDebugMenu * main_menu
The debug menu data.
Definition: debug_menu.cpp:15
BlamDebugMenuItemType::Unknown
@ Unknown
Fallback in the event that debug_menu_init contained an invalid option.
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
Blam::Resources::DebugMenu::ReleaseDebugMenu
BLAM void ReleaseDebugMenu()
Releases all debug menu contents.
Definition: debug_menu.cpp:393
BlamDebugMenuItem::HandleKeyEnter
void HandleKeyEnter()
Called when the menu item is active and the enter key is pressed.
Definition: BlamDebugMenuItem.cpp:11
BlamDebugMenuItem::max
double max
The maximum value specified in debug_menu_init.
Definition: debug_menu.h:70
BlamDebugMenuItem::use_bounds
bool use_bounds
Whether or not arbitrary bounds are specified in debug_menu_init.
Definition: debug_menu.h:67
BlamDebugMenu::title
std::string title
The title of the main page of the debug menu. Defaults to Main.
Definition: debug_menu.h:101
MENU_ITEM_TYPE_EXEC
#define MENU_ITEM_TYPE_EXEC
Macro for Executor. See #Blam::Resources::DebugMenu::Executor for details.
Definition: debug_menu.h:7
MENU_ITEM_TYPE_GLOBAL
#define MENU_ITEM_TYPE_GLOBAL
Macro for Global. See #Blam::Resources::DebugMenu::Global for details.
Definition: debug_menu.h:9
InternalUI
Namespace containing things for the engine's "internal UI", which is powered through ImGUI.
Definition: debug_menu.h:18
BLAM
#define BLAM
Definition: debug_menu.h:15
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:274
BlamDebugMenuItemType::CommandSequence
@ CommandSequence
Runs a sequence of console commands upon activation.
parse_debug_menu_xml_contents
BlamResult parse_debug_menu_xml_contents(std::string file_path)
Reads the specified file as an XML document and builds debug menu data from it.
Definition: debug_menu.cpp:213
Blam::Globals::EngineGlobal::value_raw
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:69
config.h
BlamDebugMenuItemType::Command
@ Command
Runs a console command upon activation.
BlamDebugMenu
Structure containing data for the root of the debug menu.
Definition: debug_menu.h:99
BlamUserDataFolder::DataRoot
@ DataRoot
The root of all user data. Defaults to BlamStrings::Utils::IO::GetEngineDataRoot().
MENU_ITEM_TYPE_UNKNOWN
#define MENU_ITEM_TYPE_UNKNOWN
Macro for Unknown. See #Blam::Resources::DebugMenu::Unknown for details.
Definition: debug_menu.h:6
InternalUI::UpdateFPSCounter
BLAM void UpdateFPSCounter()
Blam::Globals::EngineGlobal::type
GvarType type
The type of the global.
Definition: globals.h:66
BlamDebugMenuItem::min
double min
The minimum value specified in debug_menu_init.
Definition: debug_menu.h:69
Blam::Globals::EngineGlobal::boolean_value
bool boolean_value
The boolean value of the global.
Definition: globals.h:76
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