diff --git a/OpenRA.Game/Graphics/PlatformInterfaces.cs b/OpenRA.Game/Graphics/PlatformInterfaces.cs index f4594b520a..6318d6a733 100644 --- a/OpenRA.Game/Graphics/PlatformInterfaces.cs +++ b/OpenRA.Game/Graphics/PlatformInterfaces.cs @@ -66,6 +66,7 @@ namespace OpenRA void PumpInput(IInputHandler inputHandler); string GetClipboardText(); bool SetClipboardText(string text); + bool TryOpenUrl(string url); void GrabWindowMouseFocus(); void ReleaseWindowMouseFocus(); diff --git a/OpenRA.Game/Renderer.cs b/OpenRA.Game/Renderer.cs index 6359a4b0d7..f12312e11e 100644 --- a/OpenRA.Game/Renderer.cs +++ b/OpenRA.Game/Renderer.cs @@ -568,6 +568,11 @@ namespace OpenRA return Window.SetClipboardText(text); } + public bool TryOpenUrl(string url) + { + return Window.TryOpenUrl(url); + } + public string GLVersion => Context.GLVersion; public int DisplayCount => Window.DisplayCount; diff --git a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs index c775a53b2e..7f365731b4 100644 --- a/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs +++ b/OpenRA.Platforms.Default/Sdl2PlatformWindow.cs @@ -513,6 +513,18 @@ namespace OpenRA.Platforms.Default return Sdl2Input.SetClipboardText(text); } + public bool TryOpenUrl(string url) + { + try + { + return SDL.SDL_OpenURL(url) == 0; + } + catch + { + return false; + } + } + static void SetSDLAttributes(GLProfile profile) { SDL.SDL_GL_ResetAttributes();