Table of Contents

Class Game

Namespace
Stride.Engine
Assembly
Stride.Engine.dll

Main Game class system.

public class Game : GameBase, IDisposable, IComponent, IReferencable, ICollectorHolder, IGame, ISceneRendererContext, IGameSettingsService
Inheritance
Game
Implements
Inherited Members
Extension Methods

Constructors

Game()

Initializes a new instance of the Game class.

public Game()

Properties

Audio

Gets the audio system.

public AudioSystem Audio { get; }

Property Value

AudioSystem

The audio.

AutoLoadDefaultSettings

Automatically initializes game settings like default scene, resolution, graphics profile.

public bool AutoLoadDefaultSettings { get; set; }

Property Value

bool

ConsoleLogLevel

Gets or sets the default console log level.

public LogMessageType ConsoleLogLevel { get; set; }

Property Value

LogMessageType

The console log level.

ConsoleLogMode

Gets or sets the console log mode. See remarks.

public ConsoleLogMode ConsoleLogMode { get; set; }

Property Value

ConsoleLogMode

The console log mode.

Remarks

Defines how the console will be displayed when running the game. By default, on Windows, It will open only on debug if there are any messages logged.

DebugTextSystem

Gets the game profiler system.

public DebugTextSystem DebugTextSystem { get; }

Property Value

DebugTextSystem

EffectSystem

Gets the effect system.

public EffectSystem EffectSystem { get; }

Property Value

EffectSystem

The effect system.

Font

Gets the font system.

public IFontFactory Font { get; }

Property Value

IFontFactory

The font system.

Exceptions

InvalidOperationException

The font system is not initialized yet

GraphicsDeviceManager

Gets the graphics device manager.

public GraphicsDeviceManager GraphicsDeviceManager { get; }

Property Value

GraphicsDeviceManager

The graphics device manager.

Input

Gets the input manager.

public InputManager Input { get; }

Property Value

InputManager

The input.

ProfilingSystem

Gets the game profiler system.

public GameProfilingSystem ProfilingSystem { get; }

Property Value

GameProfilingSystem

SceneSystem

Gets the scene system.

public SceneSystem SceneSystem { get; }

Property Value

SceneSystem

The scene system.

Script

Gets the script system.

public ScriptSystem Script { get; }

Property Value

ScriptSystem

The script.

Settings

Readonly game settings as defined in the GameSettings asset Please note that it will be populated during initialization It will be ok to read them after the GameStarted event or after initialization

public GameSettings Settings { get; }

Property Value

GameSettings

SpriteAnimation

Gets the sprite animation system.

public SpriteAnimationSystem SpriteAnimation { get; }

Property Value

SpriteAnimationSystem

The sprite animation system.

Streaming

Gets the streaming system.

public StreamingManager Streaming { get; }

Property Value

StreamingManager

The streaming system.

VRDeviceSystem

Gets the VR Device System.

public VRDeviceSystem VRDeviceSystem { get; }

Property Value

VRDeviceSystem

Methods

ConfirmRenderingSettings(bool)

public override void ConfirmRenderingSettings(bool gameCreation)

Parameters

gameCreation bool

Destroy()

Disposes of object resources.

protected override void Destroy()

EndDraw(bool)

Ends the drawing of a frame. This method will always be preceeded by calls to BeginDraw() and perhaps Draw(GameTime) depending on if we had to do so.

protected override void EndDraw(bool present)

Parameters

present bool

GetLogListener()

protected virtual LogListener GetLogListener()

Returns

LogListener

Initialize()

Called after the Game is created, but before GraphicsDevice is available and before LoadContent(). Reference page contains code sample.

protected override void Initialize()

LoadContent()

Loads the content.

protected virtual Task LoadContent()

Returns

Task

PrepareContext()

Creates or updates Context before window and device are created.

protected override void PrepareContext()

Events

GameDestroyed

Static event that will be fired when a game is destroyed

public static event EventHandler GameDestroyed

Event Type

EventHandler

GameStarted

Static event that will be fired when a game is initialized

public static event EventHandler GameStarted

Event Type

EventHandler