aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-02 17:47:24 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-01-02 17:47:24 +0100
commit06ec95490b9b181fbdfbb395dba4347263a2f4bc (patch)
tree85cbcf6f42a88c2a6b3c01fe46a594fee43b4718 /example
parentb514b59a1c2ab17000b147029f5265531cadaf9f (diff)
downloadd2tk-06ec95490b9b181fbdfbb395dba4347263a2f4bc.tar.xz
all: prototype linear gradient meter.
Diffstat (limited to 'example')
-rw-r--r--example/example.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/example/example.c b/example/example.c
index 490ec59..9ed740f 100644
--- a/example/example.c
+++ b/example/example.c
@@ -56,6 +56,7 @@ typedef enum _bar_t {
BAR_SCROLL,
BAR_PANE,
BAR_FLOWMATRIX,
+ BAR_METER,
#if !defined(_WIN32) && !defined(__APPLE__)
BAR_KEYBOARD,
#endif
@@ -70,6 +71,7 @@ static const char *bar_lbl [BAR_MAX] = {
[BAR_SCROLL] = "Scrollbar",
[BAR_PANE] = "Pane",
[BAR_FLOWMATRIX] = "Flowmatrix",
+ [BAR_METER] = "Meter",
#if !defined(_WIN32) && !defined(__APPLE__)
[BAR_KEYBOARD] = "Keyboard"
#endif
@@ -389,6 +391,23 @@ _render_c_flowmatrix(d2tk_base_t *base, const d2tk_rect_t *rect)
#undef N
}
+static inline void
+_render_c_meter(d2tk_base_t *base, const d2tk_rect_t *rect)
+{
+ static int32_t val = 6; // dBFS
+
+ if(d2tk_base_meter_is_changed(base, D2TK_ID, rect, &val))
+ {
+ //FIXME
+ }
+
+ val -= 1;
+ if(val < -54)
+ {
+ val = 6;
+ }
+}
+
#if !defined(_WIN32) && !defined(__APPLE__)
static void
_fake_event(unsigned type, unsigned code, int value)
@@ -977,6 +996,10 @@ d2tk_example_run(d2tk_base_t *base, d2tk_coord_t w, d2tk_coord_t h)
{
_render_c_flowmatrix(base, &rect);
} break;
+ case BAR_METER:
+ {
+ _render_c_meter(base, &rect);
+ } break;
#if !defined(_WIN32) && !defined(__APPLE__)
case BAR_KEYBOARD:
{