Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
BlamUIWidget_FramerateDisplay.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <thread>
4 
5 #include <Strings/components/classes/events/game_engine_events/Tick/TickEvent.h>
6 #include <Strings/components/classes/events/events.h>
8 
15 class BlamUIWidget_FramerateDisplay : public BlamUIWidget, public BlamEventListener
16 {
17 private:
18  BlamUIWidget_Text* text = nullptr;
19  std::string display_format = "[{last}] {avg}\n{thread_mode}";
20  bool needs_update = false;
21 
22 public:
25 
26  void Draw() override;
27  void ShowImGuiPropertyEditor() override;
28  void UpdateMetrics() override;
29  void RefreshRelativePosition() override;
30 
31  void OnTickEvent(TickEvent* event) override;
32 };
BlamDebugMenuItem::title
std::string title
The title of the debug menu item as shown in the menu.
Definition: debug_menu.h:41
ui.h
Blam::RenderingBGFX::Stats::GetCurrentFrameRate
BLAM float GetCurrentFrameRate()
Definition: bgfx.cpp:443
BlamUIWidget_FramerateDisplay::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: BlamUIWidget_FramerateDisplay.cpp:56
Blam::Settings::Config::GetEngineConfiguration
BLAM BlamConfigurationFile * GetEngineConfiguration()
Retrieves the main engine configuration file.
Definition: config.cpp:60
BlamUIWidget_DebugMenu::menu_item_size
BlamVector2 menu_item_size
The size of each debug menu item widget.
Definition: debug_menu.h:200
Blam::Globals::GlobalExists
BLAM bool GlobalExists(std::string id)
Determines whether or not a global exists.
Definition: globals.cpp:27
BlamUIWidget_FramerateDisplay::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: BlamUIWidget_FramerateDisplay.cpp:51
BlamDebugMenuItem_Global::global_id
std::string global_id
The ID of the engine global to update.
Definition: debug_menu.h:125
BlamUIWidget_Group
Class representing a Group widget.
Definition: ui.h:287
String
@ String
Represents a std::string.
Definition: globals.h:29
BlamDebugMenuItemType::Submenu
@ Submenu
Enters into a submenu/subscreen upon activation.
BlamUIWidget::MarkForUpdate
void MarkForUpdate()
Marks the widget as needing to be updated on the next draw call.
Definition: BlamUIWidget.cpp:436
BlamUIWidget_DebugMenu_Item::ConfigureHotkeyText
void ConfigureHotkeyText(int index)
Reconfigures the widget's hotkey text based on its index.
Definition: debug_menu_item.cpp:312
BlamUIWidget::parent
BlamUIWidget_Group * parent
The parent group of this widget, if applicable.
Definition: ui.h:125
imgui.h
BlamUIWidget_DebugMenu::GetAnimatedActiveItemBackground
BlamColor GetAnimatedActiveItemBackground()
Retrieves the animating active item background color.
Definition: debug_menu.cpp:542
BlamUIWidget_2DPrimitive::color
BlamColor color
The color of the widget.
Definition: ui.h:438
Boolean
@ Boolean
Represents a boolean. Can be true or false.
Definition: globals.h:24
BlamUIWidget_DebugMenu::cached_scale_factor
float cached_scale_factor
The current cached UI scale factor. Used to automatically scale the UI when the scale factor is chang...
Definition: debug_menu.h:199
UsingBgfx
bool UsingBgfx()
Definition: bgfx.cpp:63
BlamUIWidget_Text::SetHidden
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: text.cpp:678
BlamWidgetAnchor::BottomRight
@ BottomRight
The widget will be placed at the bottom-right of the screen.
BlamEngineGlobal::boolean_value
bool boolean_value
The boolean value of the global.
Definition: globals.h:56
BlamUIWidget_Group::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: group.cpp:174
BlamUIWidget_DebugMenu_Item::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: debug_menu_item.cpp:162
rendering.h
BlamUIWidget_Text::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: text.cpp:119
BlamUIWidget_DebugMenu_Item::Draw
void Draw() override
Draws the widget on-screen.
Definition: debug_menu_item.cpp:154
BlamUIWidget_DebugMenu_Item::SetHidden
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: debug_menu_item.cpp:351
Blam::Tick::GetCurrentTickRate1M
BLAM int GetCurrentTickRate1M()
Retrieves the average tick rate over the last minute.
Definition: tick.cpp:53
BlamUIWidget::SetPosition
virtual void SetPosition(BlamVector2 new_position)
Sets the position of the widget.
Definition: BlamUIWidget.cpp:412
BlamUIWidget::ShowImGuiPropertyEditor
virtual void ShowImGuiPropertyEditor()
Displays an ImGUI-based property editor.
Definition: BlamUIWidget.cpp:94
BlamEngineGlobal::type
BlamGlobalType type
The type of the global.
Definition: globals.h:46
BlamUIWidget_Text::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: text.cpp:147
ImGui::CollapsingHeader
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
Definition: imgui_widgets.cpp:5422
tick.h
BlamUIWidget_Text::Draw
void Draw() override
Draws the widget on-screen.
Definition: text.cpp:67
BlamWidgetAnchor::TopLeft
@ TopLeft
The widget will be placed at the top-left of the screen.
BlamUIWidget_Group::children
std::vector< BlamUIWidget * > children
The list of child widgets within this group.
Definition: ui.h:294
BlamUIWidget_FramerateDisplay
Class for the framerate display widget.
Definition: BlamUIWidget_FramerateDisplay.h:15
BlamUIWidget::display_name
std::string display_name
The display name of the widget.
Definition: ui.h:113
Blam::Tick::GetCurrentTickRate10S
BLAM int GetCurrentTickRate10S()
Retrieves the average tick rate over the last 10 seconds.
Definition: tick.cpp:85
BlamUIWidget_Text::color
BlamColor color
The text foreground color.
Definition: ui.h:618
BlamUIWidget_2DPrimitive::SetHidden
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: 2d_primitive.cpp:254
BlamUIWidget::SetSize
void SetSize(BlamVector2 new_size)
Sets the size of the widget.
Definition: BlamUIWidget.cpp:405
BlamUIWidget_FramerateDisplay::RefreshRelativePosition
void RefreshRelativePosition() override
Updates the relative position of the widget, relative to its parent.
Definition: BlamUIWidget_FramerateDisplay.cpp:62
BlamDebugMenuItemType::CommandSequence
@ CommandSequence
Runs a sequence of console commands upon activation.
BlamUIWidget_DebugMenu_Item::SetIsHeader
void SetIsHeader()
Reconfigures the widget to display as a header, rather than a standard selectable item.
Definition: debug_menu_item.cpp:281
BlamUIWidget_DebugMenu::GetHotkeyCharacterFromIndex
char GetHotkeyCharacterFromIndex(int index)
Determines the hotkey character for an item at a given index.
Definition: debug_menu.cpp:558
BlamUIWidget_DebugMenu_Item::SetMenuItem
void SetMenuItem(BlamDebugMenuItem *_menu_item)
Sets the debug menu item information associated with this widget.
Definition: debug_menu_item.cpp:292
BlamEngineGlobal
Structure containing data for a game engine global.
Definition: globals.h:44
BlamDebugMenuItemType::Global
@ Global
Modifies an engine global upon activation.
globals.h
BlamUIWidget_FramerateDisplay.h
BlamUIWidget_DebugMenu_Item::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: debug_menu_item.cpp:249
BlamUIWidget_FramerateDisplay::OnTickEvent
void OnTickEvent(TickEvent *event) override
Definition: BlamUIWidget_FramerateDisplay.cpp:67
BlamUIWidget_FramerateDisplay::~BlamUIWidget_FramerateDisplay
~BlamUIWidget_FramerateDisplay()
Definition: BlamUIWidget_FramerateDisplay.cpp:31
BlamUIWidget_DebugMenu_Item::SetSize
void SetSize(float scale)
Sets the scale factor of the widget.
Definition: debug_menu_item.cpp:339
BlamUIWidget_FramerateDisplay::Draw
void Draw() override
Draws the widget on-screen.
Definition: BlamUIWidget_FramerateDisplay.cpp:37
BlamDebugMenuItem
Class representing a debug menu item.
Definition: debug_menu.h:35
BlamUIWidget_BasicRectangle
Class representing a basic rectangle widget.
Definition: ui.h:469
Blam::Rendering::GetGraphicsSystem
BLAM Demo::GraphicsSystem * GetGraphicsSystem()
Retrieves the graphics system used by OGRE.
Definition: ogre.cpp:645
debug_menu.h
BlamUIWidget
Base class for a UI widget.
Definition: ui.h:81
Blam::Globals::GetGlobal
BLAM BlamEngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: globals.cpp:189
BlamDebugMenuItemType::Command
@ Command
Runs a console command upon activation.
BlamUIWidget_2DPrimitive::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: 2d_primitive.cpp:207
BlamDebugMenuItem::GetType
BlamDebugMenuItemType GetType()
Retrieves the type of the debug menu item.
Definition: BlamDebugMenuItem.cpp:8
BlamUIWidget_DebugMenu
Class used for the Debug Menu UI.
Definition: debug_menu.h:122
BlamUIWidget_Text::text
std::string text
The text to display within this text widget.
Definition: ui.h:622
BlamUIWidget::RefreshRelativePosition
virtual void RefreshRelativePosition()
Updates the relative position of the widget, relative to its parent.
Definition: BlamUIWidget.cpp:249
BlamUIWidget::description
std::string description
An optional description of the widget.
Definition: ui.h:114
BlamUIWidget_FramerateDisplay::BlamUIWidget_FramerateDisplay
BlamUIWidget_FramerateDisplay(BlamUIWidget_Group *_parent)
Definition: BlamUIWidget_FramerateDisplay.cpp:14
BlamUIWidget_DebugMenu_Item::SetActive
void SetActive(bool _active)
Definition: debug_menu_item.cpp:243
BlamUIWidget::IsHidden
bool IsHidden()
Checks whether or not the widget is hidden.
Definition: BlamUIWidget.cpp:475
BlamUIWidget::z_index
int z_index
The Z index of the widget, where higher Z orders are drawn on top.
Definition: ui.h:120
BlamUIWidget_DebugMenu_Item::IsHeader
bool IsHeader()
Checks whether or not the current item is a header or not.
Definition: debug_menu_item.cpp:287
ImGui::Separator
IMGUI_API void Separator()
Definition: imgui_widgets.cpp:1284
config.h
Blam::RenderingBGFX::Stats::GetAverageFrameRate
BLAM float GetAverageFrameRate()
Definition: bgfx.cpp:448
BlamUIWidget_DebugMenu_Item::SetPosition
void SetPosition(BlamVector2 new_position) override
Sets the position of the widget.
Definition: debug_menu_item.cpp:333
Blam::Tick::GetCurrentTickRate5M
BLAM int GetCurrentTickRate5M()
Retrieves the average tick rate over the last 5 minutes.
Definition: tick.cpp:69
BlamUIWidget_BasicRectangle::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: rectangle.cpp:92
BlamDebugMenuItem_Global
Class representing a global debug menu item.
Definition: debug_menu.h:122
BlamUIWidget::ignore_scale_factor
bool ignore_scale_factor
Whether or not this widget should ignore the UI scale factor settings.
Definition: ui.h:128
Demo::GraphicsSystem::getRoot
Ogre::Root * getRoot(void) const
Definition: GraphicsSystem.h:147
BlamUIWidget_Group::SetHidden
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: group.cpp:189
CWT_DEBUG_MENU_ITEM
#define CWT_DEBUG_MENU_ITEM
Definition: debug_menu.h:12
BlamUIWidget_DebugMenu_Item::BlamUIWidget_DebugMenu_Item
BlamUIWidget_DebugMenu_Item(BlamDebugMenuItem *_menu_item, BlamUIWidget_DebugMenu *_debug_menu_widget, BlamUIWidget_Group *parent_group)
Constructs a new debug menu item widget.
Definition: debug_menu_item.cpp:7
BlamEngineGlobal::value_raw
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:49
Blam::Globals::GetGlobalAsBoolean
BLAM bool * GetGlobalAsBoolean(std::string name)
Retrieves a global's value as a boolean.
Definition: globals.cpp:343
BlamUIWidget_Text
Class representing a Text widget.
Definition: ui.h:550
BlamUIWidget::SetAnchorPosition
void SetAnchorPosition(BlamWidgetAnchor new_anchor_position)
Sets the anchor position of the widget.
Definition: BlamUIWidget.cpp:425