lnvis

nanovg lightning network visualizer
git clone git://jb55.com/lnvis
Log | Files | Refs | README | LICENSE

commit f4f158d63012369fbf4c1b8dbfa6606c6479ff57
parent 5238a3633ca56071dc469bdc3d9a4dd8f5a7a190
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 20 Aug 2018 20:07:42 -0700

more obvious filter targets

Diffstat:
Mln.c | 4+++-
Mln.h | 1+
Mmain.c | 9+++++++--
Mrender.c | 10++++++++--
4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ln.c b/ln.c @@ -123,8 +123,10 @@ void filter_network(const char *nodeid, struct node *filter_node, struct ln *ln) for (i = 0; i < ln->node_count; i++) { node = &ln->nodes[i]; - if (filter_node == node || (nodeid && streq(nodeid, node->id))) + if (filter_node == node || (nodeid && streq(nodeid, node->id))) { node->visible = 1; + ln->filter_target = node; + } else node->visible = 0; } diff --git a/ln.h b/ln.h @@ -130,6 +130,7 @@ struct ln { struct node *drag_target; struct node *last_drag_target; + struct node *filter_target; struct node *nodes; u32 node_count; diff --git a/main.c b/main.c @@ -177,7 +177,7 @@ void test_read_json(struct ln *ln) ln->node_count = node_count; } -int main() +int main(int argc, const char *argv[]) { GLFWwindow *window; int first = 1; @@ -185,6 +185,7 @@ int main() NVGcontext *vg = NULL; PerfGraph fps; double prevt = 0; + const char *filter; srand(0); // ln collision grid subdivision @@ -198,7 +199,11 @@ int main() | DISP_STROKE_NODES ; - const char *filter = "03f3c108ccd536b8526841f0a5c58212bb9e6584a1eb493080e7c1cc34f82dad71"; + if (argc == 2) + filter = argv[1]; + else + filter = "03f3c108ccd536b8526841f0a5c58212bb9e6584a1eb493080e7c1cc34f82dad71"; + test_read_json(&ln); ln.display_flags = flags; diff --git a/render.c b/render.c @@ -243,8 +243,14 @@ void draw_node(NVGcontext *vg, struct ln *ln, struct node *node) bg = nvgRadialGradient(vg, -light, -light, 0, r+2.0, node_color, blend); if (ln->display_flags & DISP_STROKE_NODES) { - nvgStrokeWidth(vg, 3.0f); - nvgStrokeColor(vg, dark_theme ? clear_adj : ln->clear_color.nvg_color); + if (ln->filter_target == node) { + nvgStrokeColor(vg, node_color_inv); + nvgStrokeWidth(vg, 5.0f); + } + else { + nvgStrokeColor(vg, dark_theme ? clear_adj : ln->clear_color.nvg_color); + nvgStrokeWidth(vg, 3.0f); + } nvgStroke(vg); }