[client] imgui: make graph y-axis configurable

The default of [0, 50] makes sense for FPS/UPS graphs, but does not for
things like the import graph. The latter should not take more than 5 ms
for sure.

This commit allows the min/max y-axis value to be specified when registering
the graph.
This commit is contained in:
Quantum
2021-07-28 21:56:50 -04:00
committed by Geoffrey McRae
parent aff3bff8b0
commit 134829cbf2
7 changed files with 15 additions and 11 deletions

View File

@@ -39,6 +39,8 @@ struct OverlayGraph
const char * name;
RingBuffer buffer;
bool enabled;
float min;
float max;
};
static bool graphs_init(void ** udata, void * params)
@@ -135,8 +137,8 @@ static int graphs_render(void * udata, bool interactive,
ringbuffer_getLength(graph->buffer),
ringbuffer_getStart (graph->buffer),
title,
0.0f,
50.0f,
graph->min,
graph->max,
size,
sizeof(float));
};
@@ -154,12 +156,14 @@ struct LG_OverlayOps LGOverlayGraphs =
.render = graphs_render
};
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer)
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, float min, float max)
{
struct OverlayGraph * graph = malloc(sizeof(struct OverlayGraph));
graph->name = name;
graph->buffer = buffer;
graph->enabled = true;
graph->min = min;
graph->max = max;
ll_push(gs.graphs, graph);
return graph;
}