mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-06 07:06:10 +00:00
u/var: Add u_var_histogram_f32
This commit is contained in:
parent
84422acd74
commit
7ea7cce930
|
@ -113,6 +113,14 @@ struct u_var_draggable_u16
|
||||||
uint16_t max;
|
uint16_t max;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct u_var_histogram_f32
|
||||||
|
{
|
||||||
|
float *values; //!< Bin heights
|
||||||
|
int count; //!< Number of bins
|
||||||
|
float width; //!< Widget width or 0 for auto
|
||||||
|
float height; //!< Widget height or 0 for auto
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* What kind of variable is this tracking.
|
* What kind of variable is this tracking.
|
||||||
*/
|
*/
|
||||||
|
@ -150,6 +158,7 @@ enum u_var_kind
|
||||||
U_VAR_KIND_GUI_HEADER,
|
U_VAR_KIND_GUI_HEADER,
|
||||||
U_VAR_KIND_BUTTON,
|
U_VAR_KIND_BUTTON,
|
||||||
U_VAR_KIND_COMBO,
|
U_VAR_KIND_COMBO,
|
||||||
|
U_VAR_KIND_HISTOGRAM_F32,
|
||||||
U_VAR_KIND_DRAGGABLE_U16,
|
U_VAR_KIND_DRAGGABLE_U16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,7 +266,8 @@ u_var_force_on(void);
|
||||||
ADD_FUNC(button, struct u_var_button, BUTTON) \
|
ADD_FUNC(button, struct u_var_button, BUTTON) \
|
||||||
ADD_FUNC(combo, struct u_var_combo, COMBO) \
|
ADD_FUNC(combo, struct u_var_combo, COMBO) \
|
||||||
ADD_FUNC(draggable_f32, struct u_var_draggable_f32, DRAGGABLE_F32) \
|
ADD_FUNC(draggable_f32, struct u_var_draggable_f32, DRAGGABLE_F32) \
|
||||||
ADD_FUNC(draggable_u16, struct u_var_draggable_u16, DRAGGABLE_U16)
|
ADD_FUNC(draggable_u16, struct u_var_draggable_u16, DRAGGABLE_U16) \
|
||||||
|
ADD_FUNC(histogram_f32, struct u_var_histogram_f32, HISTOGRAM_F32)
|
||||||
|
|
||||||
#define ADD_FUNC(SUFFIX, TYPE, ENUM) void u_var_add_##SUFFIX(void *, TYPE *, const char *);
|
#define ADD_FUNC(SUFFIX, TYPE, ENUM) void u_var_add_##SUFFIX(void *, TYPE *, const char *);
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,14 @@ on_combo_var(const char *name, void *ptr)
|
||||||
igComboStr(name, combo->value, combo->options, combo->count);
|
igComboStr(name, combo->value, combo->options, combo->count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_histogram_f32_var(const char *name, void *ptr)
|
||||||
|
{
|
||||||
|
struct u_var_histogram_f32 *h = (struct u_var_histogram_f32 *)ptr;
|
||||||
|
ImVec2 zero = {h->width, h->height};
|
||||||
|
igPlotHistogramFloatPtr(name, h->values, h->count, 0, NULL, FLT_MAX, FLT_MAX, zero, sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_draggable_f32_var(const char *name, void *ptr)
|
on_draggable_f32_var(const char *name, void *ptr)
|
||||||
{
|
{
|
||||||
|
@ -384,6 +392,7 @@ on_elem(struct u_var_info *info, void *priv)
|
||||||
case U_VAR_KIND_BUTTON: on_button_var(name, ptr); break;
|
case U_VAR_KIND_BUTTON: on_button_var(name, ptr); break;
|
||||||
case U_VAR_KIND_COMBO: on_combo_var(name, ptr); break;
|
case U_VAR_KIND_COMBO: on_combo_var(name, ptr); break;
|
||||||
case U_VAR_KIND_DRAGGABLE_U16: on_draggable_u16_var(name, ptr); break;
|
case U_VAR_KIND_DRAGGABLE_U16: on_draggable_u16_var(name, ptr); break;
|
||||||
|
case U_VAR_KIND_HISTOGRAM_F32: on_histogram_f32_var(name, ptr); break;
|
||||||
default: igLabelText(name, "Unknown tag '%i'", kind); break;
|
default: igLabelText(name, "Unknown tag '%i'", kind); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue