PerformanceOverlay class
#include <Jazz2/UI/PerformanceOverlay.h>
Table of the detailed performance metrics.
The overlay PerformanceMetricsLevel::
The texture is sized for the table, rounded up, and only ever grows, so the table changing by a digit does not reallocate it. A column is as wide as the widest text it held over the last few seconds rather than as its text is now: sized to the current text, the whole table would jump sideways every time a value gains or loses a digit, while a column that never narrowed would stay as wide as the frame time of the hitch that loaded the level. The table has no background of its own, only the text over the scene, so where a render target has no alpha channel to leave the rest of the texture see-through, it is drawn directly instead - and so it is wherever the off-screen pass cannot be set up.
Public static variables
-
static std::
int32_t MaxRows constexpr - Maximum number of rows, further ones are dropped.
Constructors, destructors, conversion operators
- PerformanceOverlay()
- ~PerformanceOverlay()
- PerformanceOverlay(const PerformanceOverlay&) deleted
Public functions
- auto operator=(const PerformanceOverlay&) -> PerformanceOverlay& deleted
- auto Update() -> bool
- Prepares the table for the frame, to be called every frame before the scene is visited.
- void AddRow(StringView label, StringView value)
- Adds a row, between Update() and Build().
- void Build(Font* font, float maxHeight)
- Lays the rows out and schedules rendering them.
-
void Draw(Canvas* canvas,
float right,
float top,
std::
uint16_t z) - Draws the table with its top right corner at the given point.
- void Release()
- Frees the texture and everything else the table holds.
Function documentation
bool Jazz2:: UI:: PerformanceOverlay:: Update()
Prepares the table for the frame, to be called every frame before the scene is visited.
Returns true when a new snapshot has been published since the table was built. The rows then hold the ones describing the frame (see nCine::
void Jazz2:: UI:: PerformanceOverlay:: Draw(Canvas* canvas,
float right,
float top,
std:: uint16_t z)
Draws the table with its top right corner at the given point.
Draws nothing until the table has been rendered for the first time.