Game Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
Main Game class system.
public class Game : GameBase, IDisposable, IComponent, IReferencable, ICollectorHolder, IGame, ISceneRendererContext, IGameSettingsService
| Name | Description | |
|---|---|---|
| Constructors | ||
| Game() | Initializes a new instance of the Game class. |
|
| Properties | ||
| Audio | Gets the audio system. |
|
| AutoLoadDefaultSettings | Automatically initializes game settings like default scene, resolution, graphics profile. |
|
| ConsoleLogLevel | Gets or sets the default console log level. |
|
| ConsoleLogMode | Gets or sets the console log mode. See remarks. |
|
| DebugTextSystem | Gets the game profiler system. |
|
| EffectSystem | Gets the effect system. |
|
| Font | Gets the font system. |
|
| GraphicsDeviceManager | Gets the graphics device manager. |
|
| Input | Gets the input manager. |
|
| ProfilingSystem | Gets the game profiler system. |
|
| SceneSystem | Gets the scene system. |
|
| Script | Gets the script system. |
|
| 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 |
|
| SpriteAnimation | Gets the sprite animation system. |
|
| Streaming | Gets the streaming system. |
|
| VRDeviceSystem | Gets the VR Device System. |
|
| Methods | ||
| ConfirmRenderingSettings(Boolean) | ||
| Destroy() | ||
| EndDraw(Boolean) | ||
| GetLogListener() | ||
| Initialize() | ||
| LoadContent() | Loads the content. |
|
| PrepareContext() | Creates or updates Context before window and device are created. |
|
| Events | ||
| GameDestroyed | Static event that will be fired when a game is destroyed |
|
| GameStarted | Static event that will be fired when a game is initialized |
|
Constructors
Game()
Initializes a new instance of the Game class.
public Game()
Properties
Audio
Gets the audio system.
public AudioSystem Audio { get; }
Property Value
| Type | Description |
|---|---|
| AudioSystem | The audio. |
AutoLoadDefaultSettings
Automatically initializes game settings like default scene, resolution, graphics profile.
public bool AutoLoadDefaultSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ConsoleLogLevel
Gets or sets the default console log level.
public LogMessageType ConsoleLogLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| LogMessageType | The console log level. |
ConsoleLogMode
Gets or sets the console log mode. See remarks.
public ConsoleLogMode ConsoleLogMode { get; set; }
Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| DebugTextSystem |
EffectSystem
Gets the effect system.
public EffectSystem EffectSystem { get; }
Property Value
| Type | Description |
|---|---|
| EffectSystem | The effect system. |
Font
Gets the font system.
public IFontFactory Font { get; }
Property Value
| Type | Description |
|---|---|
| IFontFactory | The font system. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | The font system is not initialized yet |
GraphicsDeviceManager
Gets the graphics device manager.
public GraphicsDeviceManager GraphicsDeviceManager { get; }
Property Value
| Type | Description |
|---|---|
| GraphicsDeviceManager | The graphics device manager. |
Input
Gets the input manager.
public InputManager Input { get; }
Property Value
| Type | Description |
|---|---|
| InputManager | The input. |
ProfilingSystem
Gets the game profiler system.
public GameProfilingSystem ProfilingSystem { get; }
Property Value
| Type | Description |
|---|---|
| GameProfilingSystem |
SceneSystem
Gets the scene system.
public SceneSystem SceneSystem { get; }
Property Value
| Type | Description |
|---|---|
| SceneSystem | The scene system. |
Script
Gets the script system.
public ScriptSystem Script { get; }
Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| GameSettings |
SpriteAnimation
Gets the sprite animation system.
public SpriteAnimationSystem SpriteAnimation { get; }
Property Value
| Type | Description |
|---|---|
| SpriteAnimationSystem | The sprite animation system. |
Streaming
Gets the streaming system.
public StreamingManager Streaming { get; }
Property Value
| Type | Description |
|---|---|
| StreamingManager | The streaming system. |
VRDeviceSystem
Gets the VR Device System.
public VRDeviceSystem VRDeviceSystem { get; }
Property Value
| Type | Description |
|---|---|
| VRDeviceSystem |
Methods
ConfirmRenderingSettings(Boolean)
public override void ConfirmRenderingSettings(bool gameCreation)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | gameCreation |
Overrides
Destroy()
protected override void Destroy()
Overrides
EndDraw(Boolean)
protected override void EndDraw(bool present)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | present |
Overrides
GetLogListener()
protected virtual LogListener GetLogListener()
Returns
| Type | Description |
|---|---|
| LogListener |
Initialize()
protected override void Initialize()
Overrides
LoadContent()
Loads the content.
protected virtual Task LoadContent()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
PrepareContext()
Creates or updates Context before window and device are created.
protected override void PrepareContext()
Overrides
| Improve this Doc View SourceEvents
GameDestroyed
Static event that will be fired when a game is destroyed
public static event EventHandler GameDestroyed
Event Type
| Type | Description |
|---|---|
| System.EventHandler |
GameStarted
Static event that will be fired when a game is initialized
public static event EventHandler GameStarted
Event Type
| Type | Description |
|---|---|
| System.EventHandler |