コード例 #1
0
        // Draw either a website button if the source is a valid website address,
        // or a source text if it is not.
        private void DrawWebsite()
        {
            if (_websiteValid)
            {
                if (ImGui.SmallButton(_modWebsiteButton))
                {
                    try
                    {
                        var process = new ProcessStartInfo(_modWebsite)
                        {
                            UseShellExecute = true,
                        };
                        Process.Start(process);
                    }
                    catch
                    {
                        // ignored
                    }
                }

                ImGuiUtil.HoverTooltip(_modWebsite);
            }
            else
            {
                using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
                ImGuiUtil.TextColored(Colors.MetaInfoText, "from ");
                ImGui.SameLine();
                style.Pop();
                ImGui.TextUnformatted(_mod.Website);
            }
        }
コード例 #2
0
 // Draw the author text.
 private void DrawAuthor()
 {
     using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
     ImGuiUtil.TextColored(Colors.MetaInfoText, "by ");
     ImGui.SameLine();
     style.Pop();
     ImGui.TextUnformatted(_mod.Author);
 }
コード例 #3
0
        // Draw the version in the top-right corner.
        private void DrawVersion(float offset)
        {
            var oldPos = ImGui.GetCursorPos();

            ImGui.SetCursorPos(new Vector2(2 * offset + _modNameWidth - _modVersionWidth - ImGui.GetStyle().WindowPadding.X,
                                           ImGui.GetStyle().FramePadding.Y));
            ImGuiUtil.TextColored(Colors.MetaInfoText, _modVersion);
            ImGui.SetCursorPos(oldPos);
        }