Blamite Game Engine - blam!  00272.10.26.20.0001.blamite
The core library for the Blamite Game Engine.
blam_ui.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 Blam::DebugMenu::MenuItemType::Unknown
7 #define MENU_ITEM_TYPE_EXEC Blam::DebugMenu::MenuItemType::Executor
8 #define MENU_ITEM_TYPE_CATEGORY Blam::DebugMenu::MenuItemType::Submenu
9 #define MENU_ITEM_TYPE_GLOBAL Blam::DebugMenu::MenuItemType::Global
10 #define MENU_ITEM_TYPE_MULTIEXEC Blam::DebugMenu::MenuItemType::ExecSequence
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 
27 namespace Blam::DebugMenu
28 {
33  {
35 
47  };
48 
52  class MenuItem
53  {
54  public:
56  std::string title;
57 
58  // exec only
59  std::string exec_line = "";
60 
61  // category only
62  std::vector<MenuItem> items;
63 
64  // property only
65  std::string global_id = "";
66  bool use_bounds = false;
67 
68  double inc = 1;
69  double min = 0;
70  double max = 0;
71 
72  // multiexec only
73  std::vector<std::string> exec_sequence;
75 
80  {
81 
82  }
83 
88  {
89 
90  }
91 
98  void SetupMenuItem(MenuItemType _type, std::string _title)
99  {
100  item_type = _type;
101  title = _title;
102  }
103 
104  void HandleKeyEnter();
105  void HandleKeyLeft();
106  void HandleKeyRight();
107  };
108 
112  struct Menu
113  {
114  std::string title;
115 
116  std::vector<MenuItem> items;
117  };
118 
119  // Load debug menu content from debug_menu_init.xml
120  BLAM void InitializeDebugMenu();
121  BLAM void ReloadDebugMenu();
123 }
Blam::DebugMenu::MenuItem
Class used to store data and functions relating to an item within the engine's debug menu.
Definition: blam_ui.h:52
Blam::DebugMenu::GetDebugMenu
BLAM Menu GetDebugMenu()
Retrieves the debug menu data.
Definition: debug_menu.cpp:26
Blam::DebugMenu::InitializeDebugMenu
BLAM void InitializeDebugMenu()
Initializes the debug menu.
Definition: debug_menu.cpp:332
Blam::DebugMenu::Menu
Structure containing data for the root of the debug menu.
Definition: blam_ui.h:112
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::MenuItem::title
std::string title
The title of the debug menu item as shown in the menu.
Definition: blam_ui.h:56
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::DebugMenu
Namespace containing data for the engine's debug menu.
Definition: blam_ui.h:27
Blam::DebugMenu::Unknown
@ Unknown
Fallback in the event that debug_menu_init contained an invalid option.
Definition: blam_ui.h:46
Blam::DebugMenu::ExecSequence
@ ExecSequence
Runs a sequence of console commands upon activation.
Definition: blam_ui.h:43
Blam::DebugMenu::MenuItem::HandleKeyRight
void HandleKeyRight()
Called when the menu item is active and the right arrow key is pressed.
Definition: debug_menu.cpp:529
BLAM
#define BLAM
Definition: blam_ui.h:15
Blam::DebugMenu::MenuItem::item_type
MenuItemType item_type
The type of menu item. See Blam::DebugMenu::MenuItemType for details.
Definition: blam_ui.h:55
Blam::DebugMenu::MenuItem::max
double max
The maximum value specified in debug_menu_init.
Definition: blam_ui.h:70
Blam::DebugMenu::MenuItem::use_bounds
bool use_bounds
Whether or not arbitrary bounds are specified in debug_menu_init.
Definition: blam_ui.h:66
Blam::DebugMenu::MenuItem::items
std::vector< MenuItem > items
The contents of the submenu to show upon activation.
Definition: blam_ui.h:62
Blam::DebugMenu::Menu::items
std::vector< MenuItem > items
The list of items within the debug menu.
Definition: blam_ui.h:116
Blam::DebugMenu::MenuItem::SetupMenuItem
void SetupMenuItem(MenuItemType _type, std::string _title)
Prepares the menu item for use.
Definition: blam_ui.h:98
Blam::DebugMenu::Executor
@ Executor
Runs a console command upon activation.
Definition: blam_ui.h:34
InternalUI::CreateFPSCounter
BLAM void CreateFPSCounter()
Blam::DebugMenu::MenuItem::HandleKeyEnter
void HandleKeyEnter()
Called when the menu item is active and the enter key is pressed.
Definition: debug_menu.cpp:366
Blam::DebugMenu::MenuItem::current_exec_index
int current_exec_index
The index of the next item to run within the execution sequence.
Definition: blam_ui.h:74
Blam::DebugMenu::MenuItemType
MenuItemType
Menu item type enumerator.
Definition: blam_ui.h:32
Blam::DebugMenu::Submenu
@ Submenu
Enters into a submenu/subscreen upon activation.
Definition: blam_ui.h:45
Blam::DebugMenu::MenuItem::~MenuItem
~MenuItem()
Empty and unused destructor.
Definition: blam_ui.h:87
Blam::DebugMenu::MenuItem::exec_line
std::string exec_line
The command to run upon activation for an Executor menu item type.
Definition: blam_ui.h:59
Blam::DebugMenu::MenuItem::inc
double inc
How much to add or remove from the value at a time upon activation.
Definition: blam_ui.h:68
Blam::DebugMenu::MenuItem::HandleKeyLeft
void HandleKeyLeft()
Called when the menu item is active and the left arrow key is pressed.
Definition: debug_menu.cpp:399
InternalUI
Namespace containing things for the engine's "internal UI", which is powered through ImGUI.
Definition: engine_definitions.h:250
Blam::DebugMenu::Global
@ Global
Modifies an engine global upon activation.
Definition: blam_ui.h:44
Blam::DebugMenu::MenuItem::min
double min
The minimum value specified in debug_menu_init.
Definition: blam_ui.h:69
Blam::DebugMenu::MenuItem::exec_sequence
std::vector< std::string > exec_sequence
The command sequence to run upon activation for an ExecSequence menu item type.
Definition: blam_ui.h:73
InternalUI::UpdateFPSCounter
BLAM void UpdateFPSCounter()
Blam::DebugMenu::MenuItem::global_id
std::string global_id
The ID of the engine global to modify upon activation.
Definition: blam_ui.h:65
Blam::DebugMenu::MenuItem::MenuItem
MenuItem()
Empty and unused constructor.
Definition: blam_ui.h:79