using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.IO; using System.Numerics; using System.Threading.Tasks; using Robust.Shared.GameObjects; using Robust.Shared.Graphics; using Robust.Shared.Maths; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using Color = Robust.Shared.Maths.Color; namespace Robust.Client.Graphics { public delegate void CopyPixelsDelegate(Image pixels) where T : unmanaged, IPixel; [NotContentImplementable] public interface IClyde { internal bool IsInitialized { get; } IClydeWindow MainWindow { get; } IRenderTarget MainWindowRenderTarget => MainWindow.RenderTarget; Vector2i ScreenSize { get; } bool IsFocused { get; } IEnumerable AllWindows { get; } /// /// The default scale ratio for window contents, given to us by the OS. /// Vector2 DefaultWindowScale { get; } void SetWindowTitle(string title); void SetWindowMonitor(IClydeMonitor monitor); /// /// This is the magic method to make the game window ping you in the task bar. /// void RequestWindowAttention(); event Action OnWindowResized; event Action OnWindowFocused; event Action OnWindowScaleChanged; OwnedTexture LoadTextureFromPNGStream(Stream stream, string? name = null, TextureLoadParameters? loadParams = null); OwnedTexture LoadTextureFromImage(Image image, string? name = null, TextureLoadParameters? loadParams = null) where T : unmanaged, IPixel; /// /// Creates a blank texture of the specified parameters. /// This texture can later be modified using /// /// The size of the new texture, in pixels. /// A name for the texture that can show up in debugging tools like renderdoc. /// /// Load parameters for the texture describing stuff such as sample mode. /// /// /// The type of pixels to "store" in the texture. /// This is the same type you should pass to , /// and also determines how the texture is stored internally. /// /// /// An owned, mutable texture object. /// OwnedTexture CreateBlankTexture( Vector2i size, string? name = null, in TextureLoadParameters? loadParams = null) where T : unmanaged, IPixel; /// /// Gets the clear color for the specified map viewport. /// [Pure] Color GetClearColor(EntityUid mapUid); /// /// Applies a blur to the specified render target. Requires a separate buffer with similar properties to draw intermediate steps into. /// /// The viewport being used for drawing. /// The blur target. /// The separate buffer to draw into. /// The eye being drawn with. /// Scale of how much blur to blur by. void BlurRenderTarget(IClydeViewport viewport, IRenderTarget target, IRenderTarget blurBuffer, IEye eye, float multiplier); IRenderTexture CreateLightRenderTarget(Vector2i size, string? name = null, bool depthStencil = true); IRenderTexture CreateRenderTarget(Vector2i size, RenderTargetFormatParameters format, TextureSampleParameters? sampleParameters = null, string? name = null); // Cursor API. /// /// Gets a cursor object representing standard cursors that match the OS styling. /// /// /// Cursor objects returned from this method are cached and you cannot not dispose them. /// ICursor GetStandardCursor(StandardCursorShape shape); /// /// Create a custom cursor object from an image. /// /// /// /// ICursor CreateCursor(Image image, Vector2i hotSpot); /// /// Sets the active cursor for the primary window. /// /// The cursor to set to, or to reset to the default cursor. /// Thrown if the cursor object passed has been disposed. void SetCursor(ICursor? cursor); /// /// Make a screenshot of the game, next render frame. /// /// What kind of screenshot to take /// The callback to run when the screenshot has been made. /// /// The subregion of the framebuffer to copy. /// If null, the whole framebuffer is copied. /// /// /// void Screenshot(ScreenshotType type, CopyPixelsDelegate callback, UIBox2i? subRegion = null); /// /// Async version of . /// Task> ScreenshotAsync(ScreenshotType type, UIBox2i? subRegion = null) { var tcs = new TaskCompletionSource>(); Screenshot(type, image => tcs.SetResult(image)); return tcs.Task; } IClydeViewport CreateViewport(Vector2i size, string? name = null) { return CreateViewport(size, default, name); } IClydeViewport CreateViewport(Vector2i size, TextureSampleParameters? sampleParameters, string? name = null); IEnumerable EnumerateMonitors(); IClydeWindow CreateWindow(WindowCreateParameters parameters); } }