static void GuiHintEnumSelection(ComponentDesignAttribute attribute) { if (compactmod) { ImGui.TextWrapped(attribute.Name + ": " + attribute.Description); ImGui.NewLine(); } else { ImGui.TextWrapped(attribute.Name + ":"); ImGui.SameLine(); ImGui.TextWrapped(attribute.Description); ImGui.NewLine(); } int i = 0; //_techSDs = new TechSD[attribute.GuidDictionary.Count]; _listNames = Enum.GetNames(attribute.EnumType); ImGui.TextWrapped(attribute.Value.ToString()); if (ImGui.Combo("Select", ref attribute.ListSelection, _listNames, (int)attribute.MaxValue + 1)) { int enumVal = (int)Enum.Parse(attribute.EnumType, _listNames[attribute.ListSelection]); attribute.SetValueFromInput(enumVal); } ImGui.NewLine(); }
static void GuiHintMaxMin(ComponentDesignAttribute attribute) { if (compactmod) { ImGui.TextWrapped(attribute.Name + ": " + attribute.Description); ImGui.NewLine(); } else { ImGui.TextWrapped(attribute.Name + ":"); ImGui.SameLine(); ImGui.TextWrapped(attribute.Description); ImGui.NewLine(); } attribute.SetMax(); attribute.SetMin(); //attribute.SetValue(); attribute.SetStep(); var max = attribute.MaxValue; var min = attribute.MinValue; double val = attribute.Value; double step = attribute.StepValue; double fstep = step * 10; IntPtr valPtr; IntPtr maxPtr; IntPtr minPtr; IntPtr stepPtr; IntPtr fstepPtr; unsafe { valPtr = new IntPtr(&val); maxPtr = new IntPtr(&max); minPtr = new IntPtr(&min); stepPtr = new IntPtr(&step); fstepPtr = new IntPtr(&fstep); } //ImGui.DragScalar("##slider" + attribute.Name, ImGuiDataType.Double, valPtr, 1f, minPtr, maxPtr); if (compactmod) { } else { //ImGui.PushItemWidth(-1); if (ImGui.SliderScalar("##scaler" + attribute.Name, ImGuiDataType.Double, valPtr, minPtr, maxPtr)) { attribute.SetValueFromInput(val); } } //ImGui.PushItemWidth(-1); if (ImGui.InputScalar("##input" + attribute.Name, ImGuiDataType.Double, valPtr, stepPtr, fstepPtr)) { attribute.SetValueFromInput(val); } ImGui.NewLine(); }