/// <summary> /// Draws a color4 field. /// </summary> /// <remarks>Not fully implemented yet.</remarks> public static void ColorEdit4(string label, ref Color c) { if (!CheckControlDraw()) { return; } var controlId1 = GetControlId(nameof(ColorEdit4) + "_0"); var controlId2 = GetControlId(nameof(ColorEdit4) + "_1"); var controlId3 = GetControlId(nameof(ColorEdit4) + "_2"); var controlId4 = GetControlId(nameof(ColorEdit4) + "_3"); var fieldWidth = ControlWidth / 4 - 4; GUILayout.BeginHorizontal(GUILayout.Width(ControlWidth + LabelWidth), GUILayout.Height(ControlHeight)); var r = c.r * 255f; ImGuiInternal.InternalFloatField(controlId1, string.Empty, ref r, fieldWidth); c.r = r / 255f; var g = c.g * 255f; ImGuiInternal.InternalFloatField(controlId2, string.Empty, ref g, fieldWidth); c.g = g / 255f; var b = c.b * 255f; ImGuiInternal.InternalFloatField(controlId3, string.Empty, ref b, fieldWidth); c.b = b / 255f; var a = c.a * 255f; ImGuiInternal.InternalFloatField(controlId4, string.Empty, ref a, fieldWidth); c.a = a / 255f; ImGuiInternal.ControlLabel(label, controlId1); GUILayout.EndHorizontal(); }
/// <summary> /// Draws a float field. /// </summary> public static void FloatField(string label, ref float f) => ImGuiInternal.InternalFloatField(GetControlId(nameof(FloatField)), label, ref f, ControlWidth);