mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 22:01:46 +00:00
[client] overlay: add new configuration overlay [wip]
This commit is contained in:
parent
80c9f7223a
commit
d2c36b8449
6 changed files with 31 additions and 4 deletions
|
@ -118,6 +118,7 @@ set(SOURCES
|
|||
src/overlay/fps.c
|
||||
src/overlay/graphs.c
|
||||
src/overlay/help.c
|
||||
src/overlay/config.c
|
||||
)
|
||||
|
||||
# Force cimgui to build as a static library.
|
||||
|
|
|
@ -825,6 +825,7 @@ static int lg_run(void)
|
|||
app_registerOverlay(&LGOverlayFPS , NULL);
|
||||
app_registerOverlay(&LGOverlayGraphs, NULL);
|
||||
app_registerOverlay(&LGOverlayHelp , NULL);
|
||||
app_registerOverlay(&LGOverlayConfig, NULL);
|
||||
|
||||
// initialize metrics ringbuffers
|
||||
g_state.renderTimings = ringbuffer_new(256, sizeof(float));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,12 @@ extern struct LG_OverlayOps LGOverlayAlert;
|
|||
extern struct LG_OverlayOps LGOverlayFPS;
|
||||
extern struct LG_OverlayOps LGOverlayGraphs;
|
||||
extern struct LG_OverlayOps LGOverlayHelp;
|
||||
extern struct LG_OverlayOps LGOverlayConfig;
|
||||
|
||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, float min, float max);
|
||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer,
|
||||
float min, float max);
|
||||
void overlayGraph_unregister();
|
||||
void overlayGraph_iterate(void (*callback)(GraphHandle handle, const char * name,
|
||||
bool * enabled, void * udata), void * udata);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,7 @@ endif()
|
|||
add_subdirectory(src/platform)
|
||||
|
||||
set(COMMON_SOURCES
|
||||
src/appstrings.c
|
||||
src/stringutils.c
|
||||
src/stringlist.c
|
||||
src/option.c
|
||||
|
|
|
@ -87,4 +87,11 @@ typedef enum CursorType
|
|||
}
|
||||
CursorType;
|
||||
|
||||
typedef struct StringPair
|
||||
{
|
||||
const char * name;
|
||||
const char * value;
|
||||
}
|
||||
StringPair;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue