|
- #pragma once
-
- #include <stdint.h> /**< uint32_t */
-
- #include "sww/renderer.h"
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef struct {
- uint32_t cursor;
- uint32_t capacity;
- uint32_t count;
- float sum;
- float values[0];
- } swwPerfMonitor;
-
- swwPerfMonitor *swwPerfMonitor_CreateWithCount(uint32_t value_count);
- void swwPerfMonitor_Destroy(swwPerfMonitor *o);
- void swwPerfMonitor_Update(swwPerfMonitor *o, float frame_time);
-
- #define swwPerfMonitor_Create() swwPerfMonitor_CreateWithCount(30)
- #define swwPerfMonitor_GetAverage(o) ((o)->sum / (o)->count)
-
- /* Draw the PerfMonitor as a layer on the canvas */
- void swwPerfMonitor_Render(swwPerfMonitor *o, swwRenderer *renderer,
- Point2i pos, Sizei size);
-
- #ifdef __cplusplus
- }
- #endif
|