···42{
43 public abstract class GameHost : IIpcHost, IDisposable
44 {
45- public GameWindow Window { get; protected set; }
4647 protected FrameworkDebugConfigManager DebugConfig { get; private set; }
4849 protected FrameworkConfigManager Config { get; private set; }
5051 /// <summary>
52- /// Whether the <see cref="GameWindow"/> is active (in the foreground).
53 /// </summary>
54 public readonly IBindable<bool> IsActive = new Bindable<bool>(true);
55
···42{
43 public abstract class GameHost : IIpcHost, IDisposable
44 {
45+ public IWindow Window { get; protected set; }
4647 protected FrameworkDebugConfigManager DebugConfig { get; private set; }
4849 protected FrameworkConfigManager Config { get; private set; }
5051 /// <summary>
52+ /// Whether the <see cref="IWindow"/> is active (in the foreground).
53 /// </summary>
54 public readonly IBindable<bool> IsActive = new Bindable<bool>(true);
55
+9-4
osu.Framework/Platform/GameWindow.cs
···15using System.Drawing;
16using JetBrains.Annotations;
17using osu.Framework.Bindables;
018using Icon = osuTK.Icon;
1920namespace osu.Framework.Platform
21{
22- public abstract class GameWindow : IGameWindow
23 {
24 /// <summary>
25 /// The <see cref="IGraphicsContext"/> associated with this <see cref="GameWindow"/>.
···8687 FocusedChanged += (o, e) => isActive.Value = Focused;
8889- SupportedWindowModes.AddRange(DefaultSupportedWindowModes);
9091 bool firstUpdate = true;
92 UpdateFrame += (o, e) =>
···223224 protected virtual void OnKeyDown(object sender, KeyboardKeyEventArgs e) => KeyDown?.Invoke(sender, e);
22500226 /// <summary>
227 /// Provides a <see cref="BindableMarginPadding"/> that can be used to keep track of the "safe area" insets on mobile
228 /// devices. This usually corresponds to areas of the screen hidden under notches and rounded corners.
229 /// The safe area insets are provided by the operating system and dynamically change as the user rotates the device.
230 /// </summary>
231- public readonly BindableMarginPadding SafeAreaPadding = new BindableMarginPadding();
232233- public readonly BindableList<WindowMode> SupportedWindowModes = new BindableList<WindowMode>();
00234235 public virtual WindowMode DefaultWindowMode => SupportedWindowModes.First();
236
···15using System.Drawing;
16using JetBrains.Annotations;
17using osu.Framework.Bindables;
18+using osu.Framework.Graphics;
19using Icon = osuTK.Icon;
2021namespace osu.Framework.Platform
22{
23+ public abstract class GameWindow : IWindow
24 {
25 /// <summary>
26 /// The <see cref="IGraphicsContext"/> associated with this <see cref="GameWindow"/>.
···8788 FocusedChanged += (o, e) => isActive.Value = Focused;
8990+ supportedWindowModes.AddRange(DefaultSupportedWindowModes);
9192 bool firstUpdate = true;
93 UpdateFrame += (o, e) =>
···224225 protected virtual void OnKeyDown(object sender, KeyboardKeyEventArgs e) => KeyDown?.Invoke(sender, e);
226227+ private readonly BindableMarginPadding safeAreaPadding = new BindableMarginPadding();
228+229 /// <summary>
230 /// Provides a <see cref="BindableMarginPadding"/> that can be used to keep track of the "safe area" insets on mobile
231 /// devices. This usually corresponds to areas of the screen hidden under notches and rounded corners.
232 /// The safe area insets are provided by the operating system and dynamically change as the user rotates the device.
233 /// </summary>
234+ public IBindable<MarginPadding> SafeAreaPadding => safeAreaPadding;
235236+ private readonly BindableList<WindowMode> supportedWindowModes = new BindableList<WindowMode>();
237+238+ public IBindableList<WindowMode> SupportedWindowModes => supportedWindowModes;
239240 public virtual WindowMode DefaultWindowMode => SupportedWindowModes.First();
241
+43
osu.Framework/Platform/IWindow.cs
···0000000000000000000000000000000000000000000
···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+4+using System;
5+using osu.Framework.Bindables;
6+using osu.Framework.Configuration;
7+using osu.Framework.Graphics;
8+using osuTK;
9+using osuTK.Platform;
10+11+namespace osu.Framework.Platform
12+{
13+ /// <summary>
14+ /// Interface representation of the game window, intended to hide any implementation-specific code.
15+ /// Currently inherits from osuTK; this will be removed as part of the <see cref="GameWindow"/> refactor.
16+ /// </summary>
17+ public interface IWindow : IGameWindow
18+ {
19+ void CycleMode();
20+21+ void SetupWindow(FrameworkConfigManager config);
22+23+ event Func<bool> ExitRequested;
24+25+ event Action Exited;
26+27+ bool CursorInWindow { get; }
28+29+ CursorState CursorState { get; set; }
30+31+ VSyncMode VSync { get; set; }
32+33+ WindowMode DefaultWindowMode { get; }
34+35+ DisplayDevice CurrentDisplay { get; }
36+37+ IBindable<bool> IsActive { get; }
38+39+ IBindable<MarginPadding> SafeAreaPadding { get; }
40+41+ IBindableList<WindowMode> SupportedWindowModes { get; }
42+ }
43+}