Class DebugMenu

Inheritance Relationships

Base Types

Class Documentation

class DebugMenu : public BlamRendering::RenderStack::StackObjectBase, public Blam::Events::EventListener

Stack item representing the debug menu.

This debug menu implementation works almost identical to the one seen in Halo 2. For more details on the debug menu itself, see Blam::DebugMenu

Public Functions

DebugMenu()

Prepares the debug menu for display.

~DebugMenu()

Cleans up all debug menu data.

void onCharacterInputEvent(Blam::Events::CharacterInputEvent *event)

Called when the listener is subscribed to Character Input events, and a new CharacterInputEvent is fired.

Parameters
  • -: The event that was fired.

void onKeyPressEvent(Blam::Events::KeyPressEvent *event)

Called when the listener is subscribed to Key Press events, and a new KeyPressEvent is fired.

Parameters
  • -: The event that was fired.

int CurrentMenuItemCount()

Returns the number of items within the currently displayed list.

Includes items not visible onscreen.

void PokePropertyChanges()

Adjust any properties to ensure that everything is displayed properly and respects the UI scale factor.

void build_menu_list_thread(std::vector<Blam::DebugMenu::MenuItem> item_list, std::string menu_title)

Rebuilds the menu contents.

Used to update the display after opening a submenu.

Note

This function is meant to be run from a thread! It will block whatever thread it is used on until a different thread unlocks it!

Parameters
  • item_list: - The new list of items in the menu.

  • menu_title: - The new title of the menu.

void BuildMenuList(std::vector<Blam::DebugMenu::MenuItem> item_list, std::string menu_title)

Rebuilds the menu contents.

Used to update the display after opening a submenu.

Parameters
  • item_list: - The new list of items in the menu.

  • menu_title: - The new title of the menu.

int get_item_height_offset(int spacing_level)

Returns the new height offset of the debug menu.

Used to ensure that the menu doesn’t contain large amounts of empty space on smaller menus.

Parameters
  • spacing_level: - The number of items to draw, minus 1.

void Draw()

Draws the stack object.

Specific functionality may vary depending on the type of object.

void ShowImPropertyEditor()

Shows a set of ImGUI properties associated with the object.

This will call functions to draw only the property controls for the item, and nothing else. The window/container for the properties must be handled externally.

void toggleVisibility()

Toggles the visibility of the debug menu.

void HandleKeyUp()

Called when the Up Arrow is pressed.

Moves upwards in the menu, or navigates to the bottom of the menu if we are already at the top of the menu.

void HandleKeyDown()

Called when the Down Arrow is pressed.

Navigates downward in the menu, or returns back to the top if we are already at the last item.

void HandleKeyEnter()

Called when the Enter key is pressed.

Either triggers the item (such as incrementing it) in the case of a global, or opens the selected item’s submenu.

void HandleKeyLeft()

Called when the Left Arrow is pressed.

Used to decrement the selected global. Does nothing otherwise.

void HandleKeyRight()

Called when the Right Arrow is pressed.

Used to increment the selected global. Does nothing otherwise.

void HandleKeyBackspace()

Called when the Backspace key is pressed.

Currently does nothing, ideally we would have this be used to navigate to the previous menu.

void HandleKeyTab()

Called when the Tab key is pressed.

Currently does nothing.

void HandleKeyNumericShortcut(int number)

Called when a number from 0 to 9 is pressed.

Used for shortcut handling.

void HandleKeyHome()

Called when the Home key is pressed.

Returns to the root of the debug menu.

Public Members

D2D1_COLOR_F menu_bg = D2D1::ColorF(51.0f / 255.0f, 51.0f / 255.0f, 115.0f / 255.0f)

Background color of the menu.

D2D1_COLOR_F header_bg = D2D1::ColorF(77.0f / 255.0f, 107.0f / 255.0f, 84.0f / 255.0f)

Background color of the header.

D2D1_COLOR_F header_text_color = D2D1::ColorF(178.0f / 255.0f, 12.0f / 255.0f, 178.0f / 255.0f)

Color of the header text.

int origin_x = 50

The X origin of the debug menu.

int origin_y = 112

The Y origin of the debug menu.

int contents_left_margin_base = 70

The left margin of the debug menu contents.

int contents_top_margin_base = 2

The top margin of the debug menu contents.

int contents_bottom_margin_base = 3

The bottom margin of the debug menu contents.

int bar_width_base = 399

The width of an item in the debug menu.

int bar_height_base = 13

The height of an item in the debug menu.

int bar_spacing_base = 5

The amount of spacing between items in the debug menu.

int active_index = 0

Index of the selected menu item.

int draw_index_start = 0

The index of the first item to draw.

int max_items_drawn = 12

Maximum number of items to draw at once.

bool visible = false

Whether or not the menu should be displayed.

bool regenerating_list = false

Whether or not we are regenerating the debug menu contents.

bool done_drawing = false

Whether or not we are finished regenerating the debug menu contents.

float width_base = 0

The width of the debug menu.

float height_base = 0

The height of the debug menu.

float contents_left_margin = contents_left_margin_base

Copy of contents_left_margin_base, accounting for UI scale factor.

float contents_top_margin = contents_top_margin_base

Copy of contents_top_margin_base, accounting for UI scale factor.

float contents_bottom_margin = contents_bottom_margin_base

Copy of contents_bottom_margin_base, accounting for UI scale factor.

float bar_width = bar_width_base

Copy of bar_width_base, accounting for UI scale factor.

float bar_height = bar_height_base

Copy of bar_height_base, accounting for UI scale factor.

float bar_spacing = bar_spacing_base

Copy of bar_spacing_base, accounting for UI scale factor.

float ui_scale_factor = 1.0f

Local copy of the UI scale factor global to know when the factor has been changed.