aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-11-16 09:40:25 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-11-16 09:40:25 +0100
commit3674e3008bb1e9ad6ccfcf3093a0f3fb5cc92a3f (patch)
tree7bc00361e3cf29f35b96bbf2e3e2413a6a8d5f42 /example
parent7f3972c3c4ab51585577066e91d61ec09a35b6b7 (diff)
downloadd2tk-3674e3008bb1e9ad6ccfcf3093a0f3fb5cc92a3f.tar.xz
base: prototype flowmatrix arcs.
Diffstat (limited to 'example')
-rw-r--r--example/example.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/example/example.c b/example/example.c
index 1e8d33a..83272c3 100644
--- a/example/example.c
+++ b/example/example.c
@@ -334,7 +334,10 @@ _render_c_pane(d2tk_base_t *base, const d2tk_rect_t *rect)
static inline void
_render_c_flowmatrix(d2tk_base_t *base, const d2tk_rect_t *rect)
{
-#define N 4
+#define N 2
+ static d2tk_pos_t pos_nodes [N] = { 0 };
+ static d2tk_pos_t pos_arcs [N][N] = { 0 };
+
D2TK_BASE_FLOWMATRIX(base, rect, D2TK_ID, flowm)
{
for(unsigned i = 0; i < N; i++)
@@ -342,15 +345,20 @@ _render_c_flowmatrix(d2tk_base_t *base, const d2tk_rect_t *rect)
char lbl [32];
const ssize_t lbl_len = snprintf(lbl, sizeof(lbl), "Node %i", i);
- d2tk_flowmatrix_node(base, flowm, D2TK_ID_IDX(i), lbl_len, lbl, 0, 2);
+ d2tk_flowmatrix_node(base, flowm, &pos_nodes[i], D2TK_ID_IDX(i),
+ lbl_len, lbl, 0, 2);
+ }
+
+ for(unsigned i = 0; i < N; i++)
+ {
+ const unsigned nin = i + 1;
for(unsigned j = 0; j < N; j++)
{
- const unsigned nin = i + 1;
const unsigned nout = j + 1;
- int32_t conns = alloca(nin * nout);
- d2tk_flowmatrix_arc(base, flowm, D2TK_ID_IDX(i*N+j), nin, nout, conns);
+ d2tk_flowmatrix_arc(base, flowm, &pos_nodes[i], &pos_nodes[j],
+ &pos_arcs[i][j], D2TK_ID_IDX(i*N+j), nin, nout);
}
}
}