u/var: Add u_var_ro_ftext

This commit is contained in:
Mateo de Mayo 2022-07-09 11:40:12 -03:00 committed by Moses Turner
parent db3fe110ba
commit bf9e6fa370
2 changed files with 3 additions and 0 deletions

View file

@ -144,6 +144,7 @@ enum u_var_kind
U_VAR_KIND_SINK_DEBUG,
U_VAR_KIND_LOG_LEVEL,
U_VAR_KIND_RO_TEXT,
U_VAR_KIND_RO_FTEXT,
U_VAR_KIND_RO_I32,
U_VAR_KIND_RO_U32,
U_VAR_KIND_RO_F32,
@ -251,6 +252,7 @@ u_var_force_on(void);
ADD_FUNC(sink_debug, struct u_sink_debug, SINK_DEBUG) \
ADD_FUNC(log_level, enum u_logging_level, LOG_LEVEL) \
ADD_FUNC(ro_text, const char, RO_TEXT) \
ADD_FUNC(ro_ftext, const char, RO_FTEXT) \
ADD_FUNC(ro_i32, int32_t, RO_I32) \
ADD_FUNC(ro_u32, uint32_t, RO_I32) \
ADD_FUNC(ro_f32, float, RO_F32) \

View file

@ -373,6 +373,7 @@ on_elem(struct u_var_info *info, void *priv)
}
case U_VAR_KIND_LOG_LEVEL: igComboStr(name, (int *)ptr, "Trace\0Debug\0Info\0Warn\0Error\0\0", 5); break;
case U_VAR_KIND_RO_TEXT: igText("%s: '%s'", name, (char *)ptr); break;
case U_VAR_KIND_RO_FTEXT: igText(ptr ? (char *)ptr : "%s", name); break;
case U_VAR_KIND_RO_I32: igInputScalar(name, ImGuiDataType_S32, ptr, NULL, NULL, NULL, ro_i_flags); break;
case U_VAR_KIND_RO_U32: igInputScalar(name, ImGuiDataType_U32, ptr, NULL, NULL, NULL, ro_i_flags); break;
case U_VAR_KIND_RO_F32: igInputScalar(name, ImGuiDataType_Float, ptr, NULL, NULL, "%+f", ro_i_flags); break;