Add Join Discord button.

This commit is contained in:
Ottermandias 2022-05-13 17:58:42 +02:00
parent 1874de38d0
commit e5b739fc52
2 changed files with 30 additions and 0 deletions

View file

@ -24,6 +24,7 @@ public static class Colors
public const uint RegexWarningBorder = 0xFF0000B0;
public const uint MetaInfoText = 0xAAFFFFFF;
public const uint RedTableBgTint = 0x40000080;
public const uint DiscordColor = 0xFFDA8972;
public static (uint DefaultColor, string Name, string Description) Data( this ColorId color )
=> color switch

View file

@ -47,6 +47,7 @@ public partial class ConfigWindow
DrawAdvancedSettings();
_dialogManager.Draw();
DrawDiscordButton();
}
// Changing the base mod directory.
@ -199,5 +200,33 @@ public partial class ConfigWindow
ImGui.NewLine();
}
private static void DrawDiscordButton()
{
const string discord = "Join Discord for Support";
const string address = @"https://discord.gg/kVva7DHV4r";
var width = ImGui.CalcTextSize( discord ).X + ImGui.GetStyle().FramePadding.X * 2;
if( ImGui.GetScrollMaxY() > 0 )
width += ImGui.GetStyle().ScrollbarSize + ImGui.GetStyle().ItemSpacing.X;
ImGui.SetCursorPos( new Vector2( ImGui.GetWindowWidth() - width, 0 ) );
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.DiscordColor );
if( ImGui.Button( discord ) )
{
try
{
var process = new ProcessStartInfo( address )
{
UseShellExecute = true,
};
Process.Start( process );
}
catch
{
// ignored
}
}
ImGuiUtil.HoverTooltip( $"Open {address}" );
}
}
}