[client] overlay: add new configuration overlay [wip]

This commit is contained in:
Geoffrey McRae
2021-08-04 10:27:47 +10:00
parent 80c9f7223a
commit d2c36b8449
6 changed files with 31 additions and 4 deletions

View File

@@ -97,13 +97,19 @@ static int graphs_render(void * udata, bool interactive,
float fontSize = igGetFontSize();
GraphHandle graph;
int graphCount = 0;
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
if (graph->enabled)
++graphCount;
ImVec2 pos = {0.0f, 0.0f};
igSetNextWindowBgAlpha(0.4f);
igSetNextWindowPos(pos, ImGuiCond_FirstUseEver, pos);
igSetNextWindowSize(
(ImVec2){
28.0f * fontSize,
7.0f * fontSize * ll_count(gs.graphs)
7.0f * fontSize * graphCount
},
ImGuiCond_FirstUseEver);
@@ -115,10 +121,9 @@ static int graphs_render(void * udata, bool interactive,
ImVec2 winSize;
igGetContentRegionAvail(&winSize);
const float height = (winSize.y / ll_count(gs.graphs))
const float height = (winSize.y / graphCount)
- igGetStyle()->ItemSpacing.y;
GraphHandle graph;
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
{
if (!graph->enabled)
@@ -179,3 +184,11 @@ void overlayGraph_unregister(GraphHandle handle)
{
handle->enabled = false;
}
void overlayGraph_iterate(void (*callback)(GraphHandle handle, const char * name,
bool * enabled, void * udata), void * udata)
{
GraphHandle graph;
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
callback(graph, graph->name, &graph->enabled, udata);
}