A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4namespace osu.Framework.Platform
5{
6 /// <summary>
7 /// Provides an implementation-agnostic interface on the backing graphics API.
8 /// </summary>
9 public interface IGraphicsBackend
10 {
11 /// <summary>
12 /// Whether buffer swapping should be synced to the monitor's refresh rate.
13 /// </summary>
14 bool VerticalSync { get; set; }
15
16 /// <summary>
17 /// Initialises the graphics backend, given the current window backend.
18 /// It is assumed that the window backend has been initialised.
19 /// </summary>
20 /// <param name="window">The <see cref="IWindow"/> being used for display.</param>
21 void Initialise(IWindow window);
22
23 /// <summary>
24 /// Performs a backbuffer swap immediately if <see cref="VerticalSync"/> is false,
25 /// or on the next screen refresh if true.
26 /// </summary>
27 void SwapBuffers();
28
29 /// <summary>
30 /// Makes the graphics backend the current context, if appropriate for the driver.
31 /// </summary>
32 void MakeCurrent();
33
34 /// <summary>
35 /// Clears the current context, if appropriate for the driver.
36 /// </summary>
37 void ClearCurrent();
38 }
39}