The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/var: Add u_var_draggable_u16

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
7d266c76 e5b0840d

+24 -1
+15 -1
src/xrt/auxiliary/util/u_var.h
··· 101 101 float max; 102 102 }; 103 103 104 + struct u_var_draggable_u16 105 + { 106 + //! @note Using a float instead of storing the value like @ref 107 + //! u_var_draggable_f32. It seemed better to decouple the UI from the value 108 + //! itself. 109 + //! @todo Unify "draggable" widgets interface. 110 + uint16_t *val; 111 + uint16_t step; 112 + uint16_t min; 113 + uint16_t max; 114 + }; 115 + 104 116 /*! 105 117 * What kind of variable is this tracking. 106 118 */ ··· 138 150 U_VAR_KIND_GUI_HEADER, 139 151 U_VAR_KIND_BUTTON, 140 152 U_VAR_KIND_COMBO, 153 + U_VAR_KIND_DRAGGABLE_U16, 141 154 }; 142 155 143 156 #define U_VAR_NAME_STRING_SIZE 256 ··· 243 256 ADD_FUNC(gui_header, bool, GUI_HEADER) \ 244 257 ADD_FUNC(button, struct u_var_button, BUTTON) \ 245 258 ADD_FUNC(combo, struct u_var_combo, COMBO) \ 246 - ADD_FUNC(draggable_f32, struct u_var_draggable_f32, DRAGGABLE_F32) 259 + ADD_FUNC(draggable_f32, struct u_var_draggable_f32, DRAGGABLE_F32) \ 260 + ADD_FUNC(draggable_u16, struct u_var_draggable_u16, DRAGGABLE_U16) 247 261 248 262 #define ADD_FUNC(SUFFIX, TYPE, ENUM) void u_var_add_##SUFFIX(void *, TYPE *, const char *); 249 263
+9
src/xrt/state_trackers/gui/gui_scene_debug.c
··· 229 229 igPopStyleVar(1); 230 230 } 231 231 } 232 + 232 233 static void 233 234 on_combo_var(const char *name, void *ptr) 234 235 { ··· 241 242 { 242 243 struct u_var_draggable_f32 *d = (struct u_var_draggable_f32 *)ptr; 243 244 igDragFloat(name, &d->val, d->step, d->min, d->max, "%+f", ImGuiSliderFlags_None); 245 + } 246 + 247 + static void 248 + on_draggable_u16_var(const char *name, void *ptr) 249 + { 250 + struct u_var_draggable_u16 *d = (struct u_var_draggable_u16 *)ptr; 251 + igDragScalar(name, ImGuiDataType_U16, d->val, d->step, &d->min, &d->max, NULL, ImGuiSliderFlags_None); 244 252 } 245 253 246 254 static void ··· 375 383 case U_VAR_KIND_DRAGGABLE_F32: on_draggable_f32_var(name, ptr); break; 376 384 case U_VAR_KIND_BUTTON: on_button_var(name, ptr); break; 377 385 case U_VAR_KIND_COMBO: on_combo_var(name, ptr); break; 386 + case U_VAR_KIND_DRAGGABLE_U16: on_draggable_u16_var(name, ptr); break; 378 387 default: igLabelText(name, "Unknown tag '%i'", kind); break; 379 388 } 380 389 }