[client] overlay: allow registration of runtime configuration options

This commit is contained in:
Geoffrey McRae
2021-08-05 00:47:00 +10:00
parent 4e81c7f724
commit f3f0157d3c
4 changed files with 75 additions and 15 deletions

View File

@@ -22,6 +22,7 @@
#include "cimgui.h"
#include "../main.h"
#include "../overlays.h"
#include "ll.h"
#include "common/debug.h"
@@ -43,9 +44,28 @@ struct OverlayGraph
float max;
};
static void configCallback(void * udata)
{
igCheckbox("Show Timing Graphs", &g_state.showTiming);
igSeparator();
igBeginTable("split", 2, 0, (ImVec2){}, 0);
GraphHandle graph;
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
{
igTableNextColumn();
igCheckbox(graph->name, &graph->enabled);
}
igEndTable();
}
static bool graphs_init(void ** udata, void * params)
{
gs.graphs = ll_new();
overlayConfig_register("Performance Metrics", configCallback, NULL);
return true;
}