Skip to content

Commit 5224e0b

Browse files
committed
Add ISurfaceProvider
1 parent 129d495 commit 5224e0b

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

sources/Windowing/Common/Hosting/ISurfaceHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Silk.NET.Windowing.Hosting;
1515
/// assembly's main function.
1616
/// </remarks>
1717
[MockStaticAbstract]
18-
public interface ISurfaceHost
18+
public interface ISurfaceHost : ISurfaceProvider
1919
{
2020
/// <summary>
2121
/// Whether multiple surfaces can be spawned as children of the first surface created.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Silk.NET.Windowing;
5+
6+
/// <summary>
7+
/// Represents a windowing backend that can provide surfaces.
8+
/// </summary>
9+
public interface ISurfaceProvider
10+
{
11+
/// <summary>
12+
/// Creates a surface with the given configuration.
13+
/// </summary>
14+
/// <param name="config">The configuration for the surface..</param>
15+
/// <typeparam name="TExtra">The type of the configuration for the surface.</typeparam>
16+
/// <returns>The surface.</returns>
17+
static abstract Surface Create<TExtra>(TExtra config)
18+
where TExtra : IConfigureHost;
19+
}

sources/Windowing/Common/Surface.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static Surface Create<TExtra, TImpl>(TExtra config)
5050
/// <typeparam name="TExtra">The type of the configuration for the surface.</typeparam>
5151
/// <typeparam name="TImpl">The surface implementation.</typeparam>
5252
/// <returns>The surface.</returns>
53+
/// <remarks>This is not recommended for use if you intend to create multiple windows.</remarks>
5354
public static Surface<TImpl> CreateSingleThreaded<TExtra, TImpl>(TExtra config)
5455
where TExtra : IConfigureHost
5556
where TImpl : ISurfaceHost => Surface<TImpl>.Create(config);

0 commit comments

Comments
 (0)