Files
RobustToolbox/Robust.Client/Graphics/IClydeWindow.cs
Pieter-Jan Briers 87a5745519 SDL3 (#5583)
* Start converting SDL2 backend to SDL3.

Game starts, but a lot of stuff is broken. Oh well.

* Fix text input

SDL3 changed the API somewhat, for the better. Changes all over UI/Clyde/SDL3 layer.

* Fix mouse buttons being broken

* Remove records from SDL3 WSI

The fact that this shaved 2-3% off Robust.Client.dll is mindboggling. Records are so bad.

* Set Windows/X11 native window properties

* Fix window resize events getting wrong size

oops

* Remove "using static" from SDL3 WSI

Seriously seems to hurt IDE performance, oh well.

* Apparently I never called CheckThreadApartment().

* Add STAThreadAttribute to sandbox

Necessary for content start

* Set window title on creation properly.

* Load window icons

* Fix GLFW NoTitleBar style handling

Yeah this PR is supposed to be about SDL3, so what?

* Implement more window creation settings in SDL3

Mostly the ones that need a lot of platform-specific stuff to work.

* Make fullscreen work properly in SDL3.

* File dialogs with SDL3

Removes need for swnfd.

* Fix some TODOs

* Fix WebView build
2025-01-03 18:42:57 +01:00

75 lines
2.5 KiB
C#

using System;
using System.Numerics;
using Robust.Shared.Map;
using Robust.Shared.Maths;
namespace Robust.Client.Graphics
{
/// <summary>
/// Represents a single operating system window.
/// </summary>
public interface IClydeWindow : IDisposable
{
bool IsDisposed { get; }
WindowId Id { get; }
IRenderTarget RenderTarget { get; }
string Title { get; set; }
Vector2i Size { get; set; }
bool IsFocused { get; }
bool IsMinimized { get; }
bool IsVisible { get; set; }
Vector2 ContentScale { get; }
/// <summary>
/// If set to true, the user closing the window will also <see cref="IDisposable.Dispose"/> it.
/// </summary>
bool DisposeOnClose { get; set; }
/// <summary>
/// Fired when the user tries to close the window. Note that if <see cref="DisposeOnClose"/> is not true,
/// this is merely a request and the user pressing the close button does nothing.
/// </summary>
event Action<WindowRequestClosedEventArgs> RequestClosed;
/// <summary>
/// Raised when the window has been definitively closed.
/// This means the window must not be used anymore (it is disposed).
/// </summary>
event Action<WindowDestroyedEventArgs> Destroyed;
/// <summary>
/// Raised when the window has been resized.
/// </summary>
event Action<WindowResizedEventArgs> Resized;
/// <summary>
/// Set the active text input area in window pixel coordinates.
/// </summary>
/// <param name="rect">
/// This information is used by the OS to position overlays like IMEs or emoji pickers etc.
/// </param>
void TextInputSetRect(UIBox2i rect, int cursor);
/// <summary>
/// Indicate that the game should start accepting text input on the currently focused window.
/// </summary>
/// <remarks>
/// On some platforms, this will cause an on-screen keyboard to appear.
/// The game will also start accepting IME input if configured by the user.
/// </remarks>
/// <seealso cref="TextInputStop"/>
void TextInputStart();
/// <summary>
/// Stop text input, opposite of <see cref="TextInputStart"/>.
/// </summary>
/// <seealso cref="TextInputStart"/>
void TextInputStop();
}
public interface IClydeWindowInternal : IClydeWindow
{
nint? WindowsHWnd { get; }
}
}