Table of Contents

Class GameWindowRenderer

Namespace
Stride.Games
Assembly
Stride.Games.dll

A Game System that allows to render to a window.

public class GameWindowRenderer : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
Inheritance
object
GameWindowRenderer
Implements
Inherited Members
Extension Methods

Remarks

Note that this Game System can be used only on desktop Windows with Windows Forms currently.

Constructors

GameWindowRenderer(IServiceRegistry, GameContext)

Initializes a new instance of the GameWindowRenderer class.

public GameWindowRenderer(IServiceRegistry registry, GameContext gameContext)

Parameters

registry IServiceRegistry

The service registry.

gameContext GameContext

The Game context that contains information about the underlying platform's native window.

Properties

GameContext

Gets a context object that contains information about the underlying platform's native window.

public GameContext GameContext { get; }

Property Value

GameContext

PreferredBackBufferFormat

Gets or sets the preferred format for the Back-Buffer.

public PixelFormat PreferredBackBufferFormat { get; set; }

Property Value

PixelFormat

PreferredBackBufferHeight

Gets or sets the preferred height for the Back-Buffer, in pixels.

public int PreferredBackBufferHeight { get; set; }

Property Value

int

PreferredBackBufferWidth

Gets or sets the preferred width for the Back-Buffer, in pixels.

public int PreferredBackBufferWidth { get; set; }

Property Value

int

PreferredDepthStencilFormat

Gets or sets the preferred Depth-Stencil format.

public PixelFormat PreferredDepthStencilFormat { get; set; }

Property Value

PixelFormat

PreferredOutputColorSpace

Gets or sets the preferred output color space the Presenter should use.

public ColorSpaceType PreferredOutputColorSpace { get; set; }

Property Value

ColorSpaceType

Remarks

The output color space can be used to render to HDR monitors.

Note that this is currently only supported in Stride when using the Direct3D Graphics API. For more information about High Dynamic Range (HDR) rendering, see https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range.

Presenter

Gets or sets the presenter that is used to render the Game to the window.

public GraphicsPresenter Presenter { get; protected set; }

Property Value

GraphicsPresenter

Window

Gets the window where the Game is rendered.

public GameWindow Window { get; }

Property Value

GameWindow

Methods

BeginDraw()

Starts the drawing of the Game Component. It prepares the drawable component for rendering and determines whether a following Draw(GameTime) and EndDraw() call should occur.

public override bool BeginDraw()

Returns

bool

true if Draw(GameTime) should be called; false otherwise.

CreateOrUpdatePresenter()

Creates a new GraphicsPresenter or updates the existing one for rendering graphics.

protected virtual void CreateOrUpdatePresenter()

Remarks

This method initializes the Presenter if it is currently null, using the requested size and format. It configures the presentation parameters, including Depth-Stencil format and presentation interval.

Destroy()

Disposes the object's resources.

protected override void Destroy()

Remarks

Override in a derived class to implement disposal logic specific to it.

This method is automatically called whenever a call to Dispose() (or to Release()) has decreased the internal reference count to zero, meaning no other objects (hopefully) hold a reference to this one and its resources can be safely released.

EndDraw()

Ends the drawing of the Game Component.

public override void EndDraw()

Remarks

This method must be preceeded by calls to Draw(GameTime) and BeginDraw().

Exceptions

GraphicsDeviceException

The Game Device this Game Component is using to draw itself is not in a valid state to end drawing, or it is not available.

Initialize()

Initializes the Game System.

public override void Initialize()

Remarks

This method is called when the component is added to the Game. This can be used for tasks like querying for services the component needs and setting up non-graphics resources (as here the Graphics Device may have not been initialized yet).