Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Paradox.Games.GameBase Class Reference

The game. More...

Inheritance diagram for SiliconStudio.Paradox.Games.GameBase:
SiliconStudio.Core.ComponentBase SiliconStudio.Paradox.Games.IGame SiliconStudio.Paradox.Games.IVirtualResolution SiliconStudio.Core.IComponent SiliconStudio.Core.ICollectorHolder SiliconStudio.Core.IReferencable SiliconStudio.Core.IReferencable SiliconStudio.Paradox.Game SiliconStudio.Paradox.Graphics.Regression.TestGameBase SiliconStudio.Paradox.Graphics.Regression.GraphicsTestBase SiliconStudio.Paradox.Graphics.Regression.GraphicsTestBase

Public Member Functions

void Exit ()
 Exits the game. More...
 
void ResetElapsedTime ()
 Resets the elapsed time counter. More...
 
void Run (GameContext gameContext=null)
 Call this method to initialize the game, begin running the game loop, and start processing events for the game. More...
 
void SuppressDraw ()
 Prevents calls to Draw until the next Update. More...
 
void Tick ()
 Updates the game's clock and calls Update and Draw. More...
 
- Public Member Functions inherited from SiliconStudio.Core.ComponentBase
void Dispose ()
 
override string ToString ()
 

Protected Member Functions

 GameBase ()
 Initializes a new instance of the GameBase class. More...
 
virtual bool BeginDraw ()
 Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw. More...
 
virtual void BeginRun ()
 Called after all components are initialized but before the first update in the game loop. More...
 
override void Destroy ()
 Disposes of object resources. More...
 
virtual void Draw (GameTime gameTime)
 Reference page contains code sample. More...
 
virtual void EndDraw (bool present)
 Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw. More...
 
virtual void EndRun ()
 Called after the game loop has stopped running before exiting. More...
 
virtual void Initialize ()
 Called after the Game and GraphicsDevice are created, but before LoadContent. Reference page contains code sample. More...
 
virtual void OnActivated (object sender, EventArgs args)
 Raises the Activated event. Override this method to add code to handle when the game gains focus. More...
 
virtual void OnDeactivated (object sender, EventArgs args)
 Raises the Deactivated event. Override this method to add code to handle when the game loses focus. More...
 
virtual void OnExiting (object sender, EventArgs args)
 Raises an Exiting event. Override this method to add code to handle when the game is exiting. More...
 
virtual void OnWindowCreated ()
 
virtual bool ShowMissingRequirementMessage (Exception exception)
 This is used to display an error message if there is no suitable graphics device or sound card. More...
 
virtual void UnloadContent ()
 Called when graphics resources need to be unloaded. Override this method to unload any game-specific graphics resources. More...
 
virtual void Update (GameTime gameTime)
 Reference page contains links to related conceptual articles. More...
 
- Protected Member Functions inherited from SiliconStudio.Core.ComponentBase
 ComponentBase ()
 Initializes a new instance of the ComponentBase class. More...
 
 ComponentBase (string name)
 Initializes a new instance of the ComponentBase class. More...
 
virtual void OnNameChanged ()
 Called when Name property was changed. More...
 

Protected Attributes

readonly ILogger Log
 

Properties

GameTime UpdateTime [get]
 Gets the current update time from the start of the game. More...
 
GameTime DrawTime [get]
 Gets the current draw time from the start of the game. More...
 
float DrawInterpolationFactor [get, set]
 Gets the draw interpolation factor, which is (UpdateTime - DrawTime) / TargetElapsedTime. If IsFixedTimeStep is false, it will be 0 as UpdateTime and DrawTime will be equal. More...
 
TimerTick PlayTime [get]
 Gets the play time, can be changed to match to the time of the current rendering scene. More...
 
AssetManager Asset [get, set]
 Gets or sets the AssetManager. More...
 
GameSystemCollection GameSystems [get, set]
 Gets the game components registered by this game. More...
 
GameContext Context [get, set]
 Gets the game context. More...
 
GraphicsDevice GraphicsDevice [get]
 Gets the graphics device. More...
 
TimeSpan InactiveSleepTime [get, set]
 Gets or sets the inactive sleep time. More...
 
bool IsActive [get, set]
 Gets a value indicating whether this instance is active. More...
 
bool IsFixedTimeStep [get, set]
 Gets or sets a value indicating whether this instance is fixed time step. More...
 
bool IsDrawDesynchronized [get, set]
 Gets or sets a value indicating whether draw can happen as fast as possible, even when IsFixedTimeStep is set. More...
 
bool EarlyExit [get, set]
 
bool IsMouseVisible [get, set]
 Gets or sets a value indicating whether the mouse should be visible. More...
 
LaunchParameters LaunchParameters [get, set]
 Gets the launch parameters. More...
 
bool IsRunning [get, set]
 Gets a value indicating whether is running. More...
 
ServiceRegistry Services [get, set]
 Gets the service container. More...
 
TimeSpan TargetElapsedTime [get, set]
 Gets or sets the target elapsed time. More...
 
GameWindow Window [get]
 Gets the abstract window. More...
 
GameState State [get, set]
 
Vector3 VirtualResolution [get, set]
 
- Properties inherited from SiliconStudio.Core.ComponentBase
long Id [get, set]
 
string Name [get, set]
 Gets or sets the name of this component. More...
 
bool IsDisposed [get, set]
 Has the component been disposed or not yet. More...
 
- Properties inherited from SiliconStudio.Core.IComponent
long Id [get]
 Gets the id of this component. More...
 
string Name [get]
 Gets the name of this component. More...
 
- Properties inherited from SiliconStudio.Core.IReferencable
int ReferenceCount [get]
 Gets the reference count of this instance. More...
 
- Properties inherited from SiliconStudio.Core.ICollectorHolder
ObjectCollector Collector [get]
 Gets the collector. More...
 
- Properties inherited from SiliconStudio.Paradox.Games.IGame
GameTime UpdateTime [get]
 Gets the current game time. More...
 
GameTime DrawTime [get]
 Gets the current draw time. More...
 
float DrawInterpolationFactor [get]
 Gets the draw interpolation factor, which is (UpdateTime - DrawTime) / TargetElapsedTime. If IsFixedTimeStep is false, it will be 0 as UpdateTime and DrawTime will be equal. More...
 
TimerTick PlayTime [get]
 Gets the play time, can be changed to match to the time of the current rendering scene. More...
 
AssetManager Asset [get]
 Gets or sets the AssetManager. More...
 
GameSystemCollection GameSystems [get]
 Gets the game components registered by this game. More...
 
GameContext Context [get]
 Gets the game context. More...
 
GraphicsDevice GraphicsDevice [get]
 Gets the graphics device. More...
 
TimeSpan InactiveSleepTime [get, set]
 Gets or sets the inactive sleep time. More...
 
bool IsActive [get]
 Gets a value indicating whether this instance is active. More...
 
bool IsFixedTimeStep [get, set]
 Gets or sets a value indicating whether this instance is fixed time step. More...
 
bool IsDrawDesynchronized [get, set]
 Gets or sets a value indicating whether draw can happen as fast as possible, even when IsFixedTimeStep is set. More...
 
bool IsMouseVisible [get, set]
 Gets or sets a value indicating whether the mouse should be visible. More...
 
LaunchParameters LaunchParameters [get]
 Gets the launch parameters. More...
 
bool IsRunning [get]
 Gets a value indicating whether is running. More...
 
ServiceRegistry Services [get]
 Gets the service container. More...
 
TimeSpan TargetElapsedTime [get, set]
 Gets or sets the target elapsed time. More...
 
GameWindow Window [get]
 Gets the abstract window. More...
 
GameState State [get, set]
 Gets or sets the state. More...
 
- Properties inherited from SiliconStudio.Paradox.Games.IVirtualResolution
Vector3 VirtualResolution [get, set]
 Gets or sets the screen virtual resolution to use for this game. More...
 

Events

EventHandler< EventArgsActivated
 Occurs when [activated]. More...
 
EventHandler< EventArgsDeactivated
 Occurs when [deactivated]. More...
 
EventHandler< EventArgsExiting
 Occurs when [exiting]. More...
 
EventHandler< EventArgsWindowCreated
 Occurs when [window created]. More...
 
EventHandler
< GameUnhandledExceptionEventArgs
UnhandledException
 
EventHandler< EventArgsVirtualResolutionChanged
 
- Events inherited from SiliconStudio.Paradox.Games.IGame
EventHandler< EventArgsActivated
 Occurs when [activated]. More...
 
EventHandler< EventArgsDeactivated
 Occurs when [deactivated]. More...
 
EventHandler< EventArgsExiting
 Occurs when [exiting]. More...
 
EventHandler< EventArgsWindowCreated
 Occurs when [window created]. More...
 
- Events inherited from SiliconStudio.Paradox.Games.IVirtualResolution
EventHandler< EventArgsVirtualResolutionChanged
 Occurs when the virtual resolution changed. More...
 

Additional Inherited Members

- Public Attributes inherited from SiliconStudio.Core.ComponentBase
PropertyContainer Tags
 Gets the attached properties to this component. More...
 

Detailed Description

The game.

Definition at line 39 of file GameBase.cs.

Constructor & Destructor Documentation

SiliconStudio.Paradox.Games.GameBase.GameBase ( )
protected

Initializes a new instance of the GameBase class.

Definition at line 87 of file GameBase.cs.

References SiliconStudio.Core.Diagnostics.Log.

Member Function Documentation

virtual bool SiliconStudio.Paradox.Games.GameBase.BeginDraw ( )
protectedvirtual

Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw.

Returns
true to continue drawing, false to not call Draw and EndDraw

Definition at line 676 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.BeginRun ( )
protectedvirtual

Called after all components are initialized but before the first update in the game loop.

Definition at line 689 of file GameBase.cs.

override void SiliconStudio.Paradox.Games.GameBase.Destroy ( )
protectedvirtual

Disposes of object resources.

Reimplemented from SiliconStudio.Core.ComponentBase.

Definition at line 693 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.Draw ( GameTime  gameTime)
protectedvirtual

Reference page contains code sample.

Parameters
gameTimeTime passed since the last call to Draw.

Reimplemented in SiliconStudio.Paradox.Graphics.Regression.GraphicsTestBase, and SiliconStudio.Paradox.Graphics.Regression.GraphicsTestBase.

Definition at line 734 of file GameBase.cs.

References SiliconStudio.Paradox.Graphics.GraphicsDevice.BackBuffer.

virtual void SiliconStudio.Paradox.Games.GameBase.EndDraw ( bool  present)
protectedvirtual

Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw.

Reimplemented in SiliconStudio.Paradox.Game.

Definition at line 751 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.EndRun ( )
protectedvirtual

Called after the game loop has stopped running before exiting.

Definition at line 760 of file GameBase.cs.

void SiliconStudio.Paradox.Games.GameBase.Exit ( )

Exits the game.

Definition at line 364 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.Initialize ( )
protectedvirtual

Called after the Game and GraphicsDevice are created, but before LoadContent. Reference page contains code sample.

Reimplemented in SiliconStudio.Paradox.Game.

Definition at line 765 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.OnActivated ( object  sender,
EventArgs  args 
)
protectedvirtual

Raises the Activated event. Override this method to add code to handle when the game gains focus.

Parameters
senderThe Game.
argsArguments for the Activated event.

Definition at line 788 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.OnDeactivated ( object  sender,
EventArgs  args 
)
protectedvirtual

Raises the Deactivated event. Override this method to add code to handle when the game loses focus.

Parameters
senderThe Game.
argsArguments for the Deactivated event.

Definition at line 802 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.OnExiting ( object  sender,
EventArgs  args 
)
protectedvirtual

Raises an Exiting event. Override this method to add code to handle when the game is exiting.

Parameters
senderThe Game.
argsArguments for the Exiting event.

Definition at line 816 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.OnWindowCreated ( )
protectedvirtual

Definition at line 825 of file GameBase.cs.

void SiliconStudio.Paradox.Games.GameBase.ResetElapsedTime ( )

Resets the elapsed time counter.

Definition at line 373 of file GameBase.cs.

void SiliconStudio.Paradox.Games.GameBase.Run ( GameContext  gameContext = null)

Call this method to initialize the game, begin running the game loop, and start processing events for the game.

Parameters
gameContextThe window Context for this game.
Exceptions
System.InvalidOperationExceptionCannot run this instance while it is already running

Definition at line 441 of file GameBase.cs.

virtual bool SiliconStudio.Paradox.Games.GameBase.ShowMissingRequirementMessage ( Exception  exception)
protectedvirtual

This is used to display an error message if there is no suitable graphics device or sound card.

Parameters
exceptionThe exception to display.
Returns
The bool.

Definition at line 846 of file GameBase.cs.

void SiliconStudio.Paradox.Games.GameBase.SuppressDraw ( )

Prevents calls to Draw until the next Update.

Definition at line 492 of file GameBase.cs.

void SiliconStudio.Paradox.Games.GameBase.Tick ( )

Updates the game's clock and calls Update and Draw.

Definition at line 500 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.UnloadContent ( )
protectedvirtual

Called when graphics resources need to be unloaded. Override this method to unload any game-specific graphics resources.

Definition at line 854 of file GameBase.cs.

virtual void SiliconStudio.Paradox.Games.GameBase.Update ( GameTime  gameTime)
protectedvirtual

Reference page contains links to related conceptual articles.

Parameters
gameTimeTime passed since the last call to Update.

Reimplemented in SiliconStudio.Paradox.Graphics.Regression.TestGameBase.

Definition at line 865 of file GameBase.cs.

Member Data Documentation

readonly ILogger SiliconStudio.Paradox.Games.GameBase.Log
protected

Definition at line 72 of file GameBase.cs.

Property Documentation

AssetManager SiliconStudio.Paradox.Games.GameBase.Asset
getset

Gets or sets the AssetManager.

The content manager.

Definition at line 215 of file GameBase.cs.

GameContext SiliconStudio.Paradox.Games.GameBase.Context
getset

Gets the game context.

The game context.

Definition at line 227 of file GameBase.cs.

float SiliconStudio.Paradox.Games.GameBase.DrawInterpolationFactor
getset

Gets the draw interpolation factor, which is (UpdateTime - DrawTime) / TargetElapsedTime. If IsFixedTimeStep is false, it will be 0 as UpdateTime and DrawTime will be equal.

The draw interpolation factor.

Definition at line 197 of file GameBase.cs.

GameTime SiliconStudio.Paradox.Games.GameBase.DrawTime
get

Gets the current draw time from the start of the game.

The current update time.

Definition at line 183 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.EarlyExit
getset

Definition at line 270 of file GameBase.cs.

GameSystemCollection SiliconStudio.Paradox.Games.GameBase.GameSystems
getset

Gets the game components registered by this game.

The game components.

Definition at line 221 of file GameBase.cs.

GraphicsDevice SiliconStudio.Paradox.Games.GameBase.GraphicsDevice
get

Gets the graphics device.

The graphics device.

Definition at line 234 of file GameBase.cs.

TimeSpan SiliconStudio.Paradox.Games.GameBase.InactiveSleepTime
getset

Gets or sets the inactive sleep time.

The inactive sleep time.

Definition at line 250 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.IsActive
getset

Gets a value indicating whether this instance is active.

true if this instance is active; otherwise, false.

Definition at line 256 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.IsDrawDesynchronized
getset

Gets or sets a value indicating whether draw can happen as fast as possible, even when IsFixedTimeStep is set.

true if this instance allows desychronized drawing; otherwise, false.

Definition at line 268 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.IsFixedTimeStep
getset

Gets or sets a value indicating whether this instance is fixed time step.

true if this instance is fixed time step; otherwise, false.

Definition at line 262 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.IsMouseVisible
getset

Gets or sets a value indicating whether the mouse should be visible.

true if the mouse should be visible; otherwise, false.

Definition at line 277 of file GameBase.cs.

bool SiliconStudio.Paradox.Games.GameBase.IsRunning
getset

Gets a value indicating whether is running.

Definition at line 302 of file GameBase.cs.

LaunchParameters SiliconStudio.Paradox.Games.GameBase.LaunchParameters
getset

Gets the launch parameters.

The launch parameters.

Definition at line 297 of file GameBase.cs.

TimerTick SiliconStudio.Paradox.Games.GameBase.PlayTime
get

Gets the play time, can be changed to match to the time of the current rendering scene.

The play time.

Definition at line 204 of file GameBase.cs.

GameState SiliconStudio.Paradox.Games.GameBase.State
getset

Definition at line 332 of file GameBase.cs.

TimeSpan SiliconStudio.Paradox.Games.GameBase.TargetElapsedTime
getset

Gets or sets the target elapsed time.

The target elapsed time.

Definition at line 314 of file GameBase.cs.

GameTime SiliconStudio.Paradox.Games.GameBase.UpdateTime
get

Gets the current update time from the start of the game.

The current update time.

Definition at line 171 of file GameBase.cs.

Vector3 SiliconStudio.Paradox.Games.GameBase.VirtualResolution
getset

Definition at line 335 of file GameBase.cs.

GameWindow SiliconStudio.Paradox.Games.GameBase.Window
get

Gets the abstract window.

The window.

Definition at line 321 of file GameBase.cs.

Event Documentation

EventHandler<EventArgs> SiliconStudio.Paradox.Games.GameBase.Activated

Occurs when [activated].

Definition at line 143 of file GameBase.cs.

EventHandler<EventArgs> SiliconStudio.Paradox.Games.GameBase.Deactivated

Occurs when [deactivated].

Definition at line 148 of file GameBase.cs.

EventHandler<EventArgs> SiliconStudio.Paradox.Games.GameBase.Exiting

Occurs when [exiting].

Definition at line 153 of file GameBase.cs.

EventHandler<GameUnhandledExceptionEventArgs> SiliconStudio.Paradox.Games.GameBase.UnhandledException

Definition at line 160 of file GameBase.cs.

EventHandler<EventArgs> SiliconStudio.Paradox.Games.GameBase.VirtualResolutionChanged

Definition at line 350 of file GameBase.cs.

EventHandler<EventArgs> SiliconStudio.Paradox.Games.GameBase.WindowCreated

Occurs when [window created].

Definition at line 158 of file GameBase.cs.


The documentation for this class was generated from the following file: