Skip to content

Commit

Permalink
some settings cleanup and finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
domportera committed Oct 8, 2022
1 parent d911835 commit 03789bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
5 changes: 5 additions & 0 deletions T3/Gui/SettingsUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ public static bool DrawSettingsTable(string tableID, UIControlledSetting[] setti
return changed;
}

/// <summary>
/// Draws a series of settings in order
/// </summary>
/// <param name="settings"></param>
/// <returns></returns>
public static bool DrawSettings(UIControlledSetting[] settings)
{
ImGui.NewLine();
Expand Down
17 changes: 6 additions & 11 deletions T3/Gui/UiHelpers/UIControlledSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,16 @@ public UIControlledSetting(string label, Func<string, bool> guiFunc, string tool
/// If an Action was provided in constructor, it will be executed when value is changed. </returns>
public bool DrawGUIControl()
{
//if (!string.IsNullOrEmpty(tooltip))
//{
// if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
// {
// ImGui.SetTooltip(tooltip);
// }
//}

var changed = guiFunc.Invoke();

if (!string.IsNullOrEmpty(tooltip))
{
CustomComponents.TooltipForLastItem(tooltip, additionalNotes);
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
{
ImGui.SetTooltip(tooltip);
}
}

var changed = guiFunc.Invoke();

if(changed)
{
OnValueChanged?.Invoke();
Expand Down
6 changes: 3 additions & 3 deletions T3/Gui/Windows/SettingsInSettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ public partial class SettingsWindow
new UIControlledSetting
(
label: "Smoothing",
guiFunc: (string guiLabel) => ImGui.DragFloat(guiLabel, ref UserSettings.Config.SpaceMouseDamping, 0.01f, 0.01f, 1f)
guiFunc: (string guiLabel) => CustomComponents.FloatValueEdit(guiLabel, ref UserSettings.Config.SpaceMouseDamping, 0.01f, 1f)
),

new UIControlledSetting
(
label: "Move Speed",
guiFunc: (string guiLabel) => ImGui.DragFloat(guiLabel, ref UserSettings.Config.SpaceMouseMoveSpeedFactor, 0.01f, 0, 10f)
guiFunc: (string guiLabel) => CustomComponents.FloatValueEdit(guiLabel, ref UserSettings.Config.SpaceMouseMoveSpeedFactor, 0, 10f)
),

new UIControlledSetting
(
label: "Rotation Speed",
guiFunc: (string guiLabel) => ImGui.DragFloat(guiLabel, ref UserSettings.Config.SpaceMouseRotationSpeedFactor, 0.01f, 0, 10f)
guiFunc: (string guiLabel) => CustomComponents.FloatValueEdit(guiLabel, ref UserSettings.Config.SpaceMouseRotationSpeedFactor, 0, 10f)
)
};

Expand Down

0 comments on commit 03789bd

Please sign in to comment.