Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.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 };
ui.h
BlamUIWidget_FramerateDisplay::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: BlamUIWidget_FramerateDisplay.cpp:54
BlamUIWidget_FramerateDisplay::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: BlamUIWidget_FramerateDisplay.cpp:49
BlamUIWidget_Group
Class representing a Group widget.
Definition: ui.h:265
BlamUIWidget::parent
BlamUIWidget_Group * parent
The parent group of this widget, if applicable.
Definition: ui.h:132
imgui.h
BlamUIWidget_Text::SetHidden
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: text.cpp:452
BlamWidgetAnchor::BottomRight
@ BottomRight
The widget will be placed at the bottom-right of the screen.
rendering.h
BlamUIWidget_Text::ShowImGuiPropertyEditor
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: text.cpp:71
Blam::Tick::GetCurrentTickRate1M
BLAM int GetCurrentTickRate1M()
Retrieves the average tick rate over the last minute.
Definition: tick.cpp:52
BlamUIWidget::SetPosition
virtual void SetPosition(BlamVector2 new_position)
Sets the position of the widget.
Definition: BlamUIWidget.cpp:368
BlamUIWidget_Text::UpdateMetrics
void UpdateMetrics() override
Updates metrics for the widget.
Definition: text.cpp:97
tick.h
BlamUIWidget_Text::Draw
void Draw() override
Draws the widget on-screen.
Definition: text.cpp:52
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:120
Blam::Tick::GetCurrentTickRate10S
BLAM int GetCurrentTickRate10S()
Retrieves the average tick rate over the last 10 seconds.
Definition: tick.cpp:84
BlamUIWidget_Text::color
BlamColor color
The text foreground color.
Definition: ui.h:524
BlamUIWidget_FramerateDisplay::RefreshRelativePosition
void RefreshRelativePosition() override
Updates the relative position of the widget, relative to its parent.
Definition: BlamUIWidget_FramerateDisplay.cpp:60
globals.h
BlamUIWidget_FramerateDisplay.h
BlamUIWidget_FramerateDisplay::OnTickEvent
void OnTickEvent(TickEvent *event) override
Definition: BlamUIWidget_FramerateDisplay.cpp:65
BlamUIWidget_FramerateDisplay::~BlamUIWidget_FramerateDisplay
~BlamUIWidget_FramerateDisplay()
Definition: BlamUIWidget_FramerateDisplay.cpp:31
BlamUIWidget_FramerateDisplay::Draw
void Draw() override
Draws the widget on-screen.
Definition: BlamUIWidget_FramerateDisplay.cpp:37
Blam::Rendering::GetGraphicsSystem
BLAM Demo::GraphicsSystem * GetGraphicsSystem()
Retrieves the graphics system used by OGRE.
Definition: ogre.cpp:492
BlamUIWidget
Base class for a UI widget.
Definition: ui.h:89
BlamUIWidget_Text::text
std::string text
The text to display within this text widget.
Definition: ui.h:528
BlamUIWidget::RefreshRelativePosition
virtual void RefreshRelativePosition()
Updates the relative position of the widget, relative to its parent.
Definition: BlamUIWidget.cpp:212
BlamUIWidget::description
std::string description
An optional description of the widget.
Definition: ui.h:121
BlamWidgetType::FramerateDisplay
@ FramerateDisplay
Special widget. Used for the framerate display.
BlamUIWidget_FramerateDisplay::BlamUIWidget_FramerateDisplay
BlamUIWidget_FramerateDisplay(BlamUIWidget_Group *_parent)
Definition: BlamUIWidget_FramerateDisplay.cpp:14
BlamUIWidget::IsHidden
bool IsHidden()
Checks whether or not the widget is hidden.
Definition: BlamUIWidget.cpp:420
BlamWidgetType
BlamWidgetType
Enumerator listing possible UI widget types.
Definition: ui.h:60
Blam::Tick::GetCurrentTickRate5M
BLAM int GetCurrentTickRate5M()
Retrieves the average tick rate over the last 5 minutes.
Definition: tick.cpp:68
Demo::GraphicsSystem::getRoot
Ogre::Root * getRoot(void) const
Definition: GraphicsSystem.h:145
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:485
BlamUIWidget::SetAnchorPosition
void SetAnchorPosition(BlamWidgetAnchor new_anchor_position)
Sets the anchor position of the widget.
Definition: BlamUIWidget.cpp:381