Interface IVirtualScreen
API for accessing and controlling the virtual display of Socially Distant.
Namespace: SociallyDistant.Core.Modules
Assembly: SociallyDistant.Framework.dll
Syntax
public interface IVirtualScreen
Properties
Bounds
Declaration
Rectangle Bounds { get; }
Property Value
Type | Description |
---|---|
Rectangle |
Height
Gets the height, in logical pixels, of the screen.
Declaration
int Height { get; }
Property Value
Type | Description |
---|---|
int |
Width
Gets the width, in logical pixels, of the virtual screen.
Declaration
int Width { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Activate()
Switches the current render target of the GPU to that of the virtual screen. Should only be called on the main thread, and by Socially Distant itself during a game tick.
Declaration
void Activate()
Blit(Rectangle, Rectangle, RenderTarget2D?, bool)
Copies the current contents of the virtual screen to the specified render texture. If no target is given (null), the virtual screen will be drawn to the current render target of the GPU. Do not call this while the virtual screen is active, or outside of the main thread.
Declaration
void Blit(Rectangle sourceArea, Rectangle destinationArea, RenderTarget2D? target = null, bool useDirectCopy = true)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | sourceArea | |
Rectangle | destinationArea | |
RenderTarget2D | target | Nullable. Specifies the target to which the virtual screen should be copied. |
bool | useDirectCopy |
Deactivate()
Tells the GPU to stop rendering to Socially Distant's virtual screen. Should only be called on the main thread, and by Socially Distant itself during a game tick.
Declaration
void Deactivate()
SaveScreenshot(Stream)
Saves the contents of the virtual screen as PNG image data to the given stream. Do not call this during a render event.
Declaration
void SaveScreenshot(Stream destination)
Parameters
Type | Name | Description |
---|---|---|
Stream | destination | The stream to which the screenshot should be written. Must be writable. |
SetSize(int, int)
Resizes the virtual display.
Declaration
void SetSize(int newWidth, int newHeight)
Parameters
Type | Name | Description |
---|---|---|
int | newWidth | New width of the display, in logical pixels. Must be non-zero and positive. |
int | newHeight | New height of the virtual screen, in logical pixels. Must be non-zero and positive. |