Blamite Game Engine - Blam (Core)
BlamRendering::RenderStack::DebugMenu Class Reference

Stack item representing the debug menu. More...

#include <debug_menu.hpp>

+ Inheritance diagram for BlamRendering::RenderStack::DebugMenu:

Public Member Functions

 DebugMenu ()
 Prepares the debug menu for display. More...
 
 ~DebugMenu ()
 Cleans up all debug menu data. More...
 
void onCharacterInputEvent (Blam::Events::CharacterInputEvent *event)
 Called when the listener is subscribed to Character Input events, and a new CharacterInputEvent is fired. More...
 
void onKeyPressEvent (Blam::Events::KeyPressEvent *event)
 Called when the listener is subscribed to Key Press events, and a new KeyPressEvent is fired. More...
 
int CurrentMenuItemCount ()
 Returns the number of items within the currently displayed list. More...
 
void PokePropertyChanges ()
 Adjust any properties to ensure that everything is displayed properly and respects the UI scale factor. More...
 
void build_menu_list_thread (std::vector< Blam::DebugMenu::MenuItem > item_list, std::string menu_title)
 Rebuilds the menu contents. More...
 
void BuildMenuList (std::vector< Blam::DebugMenu::MenuItem > item_list, std::string menu_title)
 Rebuilds the menu contents. More...
 
int get_item_height_offset (int spacing_level)
 Returns the new height offset of the debug menu. More...
 
void Draw ()
 Draws the stack object. More...
 
void ShowImPropertyEditor ()
 Shows a set of ImGUI properties associated with the object. More...
 
void toggleVisibility ()
 Toggles the visibility of the debug menu. More...
 
void HandleKeyUp ()
 Called when the Up Arrow is pressed. More...
 
void HandleKeyDown ()
 Called when the Down Arrow is pressed. More...
 
void HandleKeyEnter ()
 Called when the Enter key is pressed. More...
 
void HandleKeyLeft ()
 Called when the Left Arrow is pressed. More...
 
void HandleKeyRight ()
 Called when the Right Arrow is pressed. More...
 
void HandleKeyBackspace ()
 Called when the Backspace key is pressed. More...
 
void HandleKeyTab ()
 Called when the Tab key is pressed. More...
 
void HandleKeyNumericShortcut (int number)
 Called when a number from 0 to 9 is pressed. More...
 
void HandleKeyHome ()
 Called when the Home key is pressed. More...
 
- Public Member Functions inherited from BlamRendering::RenderStack::StackObjectBase
 StackObjectBase ()
 Sets default values and provides a default ID to be used if none is provided. More...
 
 ~StackObjectBase ()
 Empty destructor. More...
 
virtual void HandleResize ()
 Called upon window resize events. More...
 
void SetArea (float new_area[4])
 Sets the area of the object. More...
 
void SetArea (float top, float bottom, float left, float right)
 Sets the area of the object. More...
 
void SetArea (D2D1_RECT_F new_area)
 Sets the area of the object. More...
 
void SetColor (float new_color[3])
 Sets the color of the object. More...
 
void SetColor (float r, float g, float b)
 Sets the color of the object. More...
 
void SetColor (float r, float g, float b, float a)
 Sets the color of the object. More...
 
void SetColor (D2D1::ColorF color)
 Sets the color of the object. More...
 
void SetZOrder (int z)
 Sets the Z-Order of the object. More...
 
void SetTranslation (float new_x, float new_y)
 Sets the translation of the object. More...
 
void PokeTranslation ()
 Updates the area of the object to account for any x/y coordinate changes. More...
 
void SetSize (float new_width, float new_height)
 Sets the size of the object. More...
 
void PokeSize ()
 Updates the area of the object to account for any width/height changes. More...
 
void ValidateSizeAndTranslation ()
 Validates X/Y coordinates and Width/Height sizes after the area has been modified. More...
 
std::string GetType ()
 Retrieves the type of item that this stack object is. More...
 
std::string GetDrawModeLabel ()
 Retrieves the current drawing mode of the object. More...
 
- Public Member Functions inherited from Blam::Events::EventListener
void Subscribe (EventType type)
 Subscribes to an event type. More...
 
 ~EventListener ()
 
std::vector< EventTypegetSubscribedEvents ()
 Retrieves the list of subscribed event types. More...
 
bool isSubscribed (EventType type)
 Determines whether or not the listener is subscribed to the specified event type. More...
 
void SetPriority (int new_priority)
 Sets the priority of the listener. More...
 
int GetPriority ()
 Retrieves the priority of the listener. More...
 
virtual void onTickEvent (Blam::Events::TickEvent *event)
 Called when the listener is subscribed to Key Press events, and a new TickEvent is fired. More...
 

Public Attributes

D2D1_COLOR_F menu_bg = D2D1::ColorF(51.0f / 255.0f, 51.0f / 255.0f, 115.0f / 255.0f)
 Background color of the menu. More...
 
D2D1_COLOR_F header_bg = D2D1::ColorF(77.0f / 255.0f, 107.0f / 255.0f, 84.0f / 255.0f)
 Background color of the header. More...
 
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. More...
 
int origin_x = 50
 The X origin of the debug menu. More...
 
int origin_y = 112
 The Y origin of the debug menu. More...
 
int contents_left_margin_base = 70
 The left margin of the debug menu contents. More...
 
int contents_top_margin_base = 2
 The top margin of the debug menu contents. More...
 
int contents_bottom_margin_base = 3
 The bottom margin of the debug menu contents. More...
 
int bar_width_base = 399
 The width of an item in the debug menu. More...
 
int bar_height_base = 13
 The height of an item in the debug menu. More...
 
int bar_spacing_base = 5
 The amount of spacing between items in the debug menu. More...
 
int active_index = 0
 Index of the selected menu item. More...
 
int draw_index_start = 0
 The index of the first item to draw. More...
 
int max_items_drawn = 12
 Maximum number of items to draw at once. More...
 
bool visible = false
 Whether or not the menu should be displayed. More...
 
bool regenerating_list = false
 Whether or not we are regenerating the debug menu contents. More...
 
bool done_drawing = false
 Whether or not we are finished regenerating the debug menu contents. More...
 
float width_base = 0
 The width of the debug menu. More...
 
float height_base = 0
 The height of the debug menu. More...
 
float contents_left_margin = contents_left_margin_base
 Copy of contents_left_margin_base, accounting for UI scale factor. More...
 
float contents_top_margin = contents_top_margin_base
 Copy of contents_top_margin_base, accounting for UI scale factor. More...
 
float contents_bottom_margin = contents_bottom_margin_base
 Copy of contents_bottom_margin_base, accounting for UI scale factor. More...
 
float bar_width = bar_width_base
 Copy of bar_width_base, accounting for UI scale factor. More...
 
float bar_height = bar_height_base
 Copy of bar_height_base, accounting for UI scale factor. More...
 
float bar_spacing = bar_spacing_base
 Copy of bar_spacing_base, accounting for UI scale factor. More...
 
float ui_scale_factor = 1.0f
 Local copy of the UI scale factor global to know when the factor has been changed. More...
 
- Public Attributes inherited from BlamRendering::RenderStack::StackObjectBase
D2D1_RECT_F area
 The area of the object. More...
 
D2D1_COLOR_F color
 The color of the object. More...
 
int z_order = 0
 The Z-Order of the object. More...
 
StackType type_label = STACKTYPE_GENERIC
 The type of the object. More...
 
StackItemDrawMode draw_mode = DEFAULT_DRAWMODE
 The drawing mode of the object. More...
 
bool visible = true
 Whether or not the object is visible. More...
 
float x = 0
 The X coordinate of the object. More...
 
float y = 0
 The Y coordinate of the object. More...
 
float width = 100
 The width of the object. More...
 
float height = 100
 The height of the object. More...
 
std::string unique_id = ""
 The unique ID of this object. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DebugMenu()

BlamRendering::RenderStack::DebugMenu::DebugMenu ( )
inline

Prepares the debug menu for display.

◆ ~DebugMenu()

BlamRendering::RenderStack::DebugMenu::~DebugMenu ( )
inline

Cleans up all debug menu data.

Member Function Documentation

◆ build_menu_list_thread()

void BlamRendering::RenderStack::DebugMenu::build_menu_list_thread ( std::vector< Blam::DebugMenu::MenuItem item_list,
std::string  menu_title 
)
inline

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.

◆ BuildMenuList()

void BlamRendering::RenderStack::DebugMenu::BuildMenuList ( std::vector< Blam::DebugMenu::MenuItem item_list,
std::string  menu_title 
)
inline

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.

◆ CurrentMenuItemCount()

int BlamRendering::RenderStack::DebugMenu::CurrentMenuItemCount ( )
inline

Returns the number of items within the currently displayed list.

Includes items not visible onscreen.

◆ Draw()

void BlamRendering::RenderStack::DebugMenu::Draw ( )
inlinevirtual

Draws the stack object.

Specific functionality may vary depending on the type of object.

Reimplemented from BlamRendering::RenderStack::StackObjectBase.

◆ get_item_height_offset()

int BlamRendering::RenderStack::DebugMenu::get_item_height_offset ( int  spacing_level)
inline

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.

◆ HandleKeyBackspace()

void BlamRendering::RenderStack::DebugMenu::HandleKeyBackspace ( )
inline

Called when the Backspace key is pressed.

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

◆ HandleKeyDown()

void BlamRendering::RenderStack::DebugMenu::HandleKeyDown ( )
inline

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.

◆ HandleKeyEnter()

void BlamRendering::RenderStack::DebugMenu::HandleKeyEnter ( )
inline

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.

◆ HandleKeyHome()

void BlamRendering::RenderStack::DebugMenu::HandleKeyHome ( )
inline

Called when the Home key is pressed.

Returns to the root of the debug menu.

◆ HandleKeyLeft()

void BlamRendering::RenderStack::DebugMenu::HandleKeyLeft ( )
inline

Called when the Left Arrow is pressed.

Used to decrement the selected global. Does nothing otherwise.

◆ HandleKeyNumericShortcut()

void BlamRendering::RenderStack::DebugMenu::HandleKeyNumericShortcut ( int  number)
inline

Called when a number from 0 to 9 is pressed.

Used for shortcut handling.

◆ HandleKeyRight()

void BlamRendering::RenderStack::DebugMenu::HandleKeyRight ( )
inline

Called when the Right Arrow is pressed.

Used to increment the selected global. Does nothing otherwise.

◆ HandleKeyTab()

void BlamRendering::RenderStack::DebugMenu::HandleKeyTab ( )
inline

Called when the Tab key is pressed.

Currently does nothing.

◆ HandleKeyUp()

void BlamRendering::RenderStack::DebugMenu::HandleKeyUp ( )
inline

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.

◆ onCharacterInputEvent()

void BlamRendering::RenderStack::DebugMenu::onCharacterInputEvent ( Blam::Events::CharacterInputEvent event)
inlinevirtual

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

Parameters
-The event that was fired.

Reimplemented from Blam::Events::EventListener.

◆ onKeyPressEvent()

void BlamRendering::RenderStack::DebugMenu::onKeyPressEvent ( Blam::Events::KeyPressEvent event)
inlinevirtual

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

Parameters
-The event that was fired.

Reimplemented from Blam::Events::EventListener.

◆ PokePropertyChanges()

void BlamRendering::RenderStack::DebugMenu::PokePropertyChanges ( )
inline

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

◆ ShowImPropertyEditor()

void BlamRendering::RenderStack::DebugMenu::ShowImPropertyEditor ( )
inlinevirtual

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.

Reimplemented from BlamRendering::RenderStack::StackObjectBase.

◆ toggleVisibility()

void BlamRendering::RenderStack::DebugMenu::toggleVisibility ( )
inline

Toggles the visibility of the debug menu.

Member Data Documentation

◆ active_index

int BlamRendering::RenderStack::DebugMenu::active_index = 0

Index of the selected menu item.

◆ bar_height

float BlamRendering::RenderStack::DebugMenu::bar_height = bar_height_base

Copy of bar_height_base, accounting for UI scale factor.

◆ bar_height_base

int BlamRendering::RenderStack::DebugMenu::bar_height_base = 13

The height of an item in the debug menu.

◆ bar_spacing

float BlamRendering::RenderStack::DebugMenu::bar_spacing = bar_spacing_base

Copy of bar_spacing_base, accounting for UI scale factor.

◆ bar_spacing_base

int BlamRendering::RenderStack::DebugMenu::bar_spacing_base = 5

The amount of spacing between items in the debug menu.

◆ bar_width

float BlamRendering::RenderStack::DebugMenu::bar_width = bar_width_base

Copy of bar_width_base, accounting for UI scale factor.

◆ bar_width_base

int BlamRendering::RenderStack::DebugMenu::bar_width_base = 399

The width of an item in the debug menu.

◆ contents_bottom_margin

float BlamRendering::RenderStack::DebugMenu::contents_bottom_margin = contents_bottom_margin_base

Copy of contents_bottom_margin_base, accounting for UI scale factor.

◆ contents_bottom_margin_base

int BlamRendering::RenderStack::DebugMenu::contents_bottom_margin_base = 3

The bottom margin of the debug menu contents.

◆ contents_left_margin

float BlamRendering::RenderStack::DebugMenu::contents_left_margin = contents_left_margin_base

Copy of contents_left_margin_base, accounting for UI scale factor.

◆ contents_left_margin_base

int BlamRendering::RenderStack::DebugMenu::contents_left_margin_base = 70

The left margin of the debug menu contents.

◆ contents_top_margin

float BlamRendering::RenderStack::DebugMenu::contents_top_margin = contents_top_margin_base

Copy of contents_top_margin_base, accounting for UI scale factor.

◆ contents_top_margin_base

int BlamRendering::RenderStack::DebugMenu::contents_top_margin_base = 2

The top margin of the debug menu contents.

◆ done_drawing

bool BlamRendering::RenderStack::DebugMenu::done_drawing = false

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

◆ draw_index_start

int BlamRendering::RenderStack::DebugMenu::draw_index_start = 0

The index of the first item to draw.

◆ header_bg

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

Background color of the header.

◆ header_text_color

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

Color of the header text.

◆ height_base

float BlamRendering::RenderStack::DebugMenu::height_base = 0

The height of the debug menu.

◆ max_items_drawn

int BlamRendering::RenderStack::DebugMenu::max_items_drawn = 12

Maximum number of items to draw at once.

◆ menu_bg

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

Background color of the menu.

◆ origin_x

int BlamRendering::RenderStack::DebugMenu::origin_x = 50

The X origin of the debug menu.

◆ origin_y

int BlamRendering::RenderStack::DebugMenu::origin_y = 112

The Y origin of the debug menu.

◆ regenerating_list

bool BlamRendering::RenderStack::DebugMenu::regenerating_list = false

Whether or not we are regenerating the debug menu contents.

◆ ui_scale_factor

float BlamRendering::RenderStack::DebugMenu::ui_scale_factor = 1.0f

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

◆ visible

bool BlamRendering::RenderStack::DebugMenu::visible = false

Whether or not the menu should be displayed.

◆ width_base

float BlamRendering::RenderStack::DebugMenu::width_base = 0

The width of the debug menu.


The documentation for this class was generated from the following file: