CoreGame<TInitialWorld, TWorldManager>

Warning

This documentation is for an implementation of a service. This class is not meant to be used directly; instead use the Protogame.CoreGame{TInitialWorld} service via dependency injection to access this functionality.

Information documented here may not be up to date.

class CoreGame<TInitialWorld, TWorldManager> : System.Object, Protogame.ICoreGame

The implementation of Protogame’s base game class. In previous versions of Protogame, this acted as the base class for the developer’s Game class. However newer games written in Protogame should use T:Protogame.CoreGame`1 instead, as this correctly sets games to use the new render pipeline, which sets TWorldManager to be T:Protogame.RenderPipelineWorldManager automatically.

Type Parameters:
 
  • TInitialWorld – The initial world class to start the game with.
  • TWorldManager – The world manager class for this game.
readonly IGameContext GameContext

Gets the current game context. You should not generally access this property; outside an explicit Update or Render loop, the state of the game context is not guaranteed. Inside the context of an Update or Render loop, the game context is already provided.

Value:The current game context.
readonly IUpdateContext UpdateContext

Gets the current update context. You should not generally access this property; outside an explicit Update loop, the state of the update context is not guaranteed. Inside the context of an Update loop, the update context is already provided.

Value:The current update context.
readonly IRenderContext RenderContext

Gets the current render context. You should not generally access this property; outside an explicit Render loop, the state of the render context is not guaranteed. Inside the context of an Render loop, the render context is already provided.

Value:The current update context.
bool IsMouseVisible
readonly bool IsActive
readonly Protogame.IGameWindow Window

A platform independent representation of a game window.

Value:The game window.
readonly GraphicsDevice GraphicsDevice

The graphics device used by the game.

Value:The graphics device.
int SkipFrames

The number of frames to skip before updating or rendering.

readonly Protogame.IHostGame HostGame
readonly bool HasLoadedContent
public void AssignHost(Protogame.IHostGame hostGame)

Called by P:Protogame.CoreGame`2.HostGame to assign itself to this game instance, allowing us to access MonoGame game members.

Parameters:
  • hostGame (Protogame.IHostGame) – The MonoGame game instance.
public void EnableImmediateStartFromHost()
public void LoadContent()
public void UnloadContent()
public void DeviceLost()
public void DeviceResetting()
public void DeviceReset()
public void ResourceCreated(System.Object resource)
Parameters:
  • resource (System.Object) –
public void ResourceDestroyed(string name, System.Object tag)
Parameters:
  • name (string) –
  • tag (System.Object) –
public void add_Exiting(System.EventHandler value)
Parameters:
  • value (System.EventHandler) –
public void remove_Exiting(System.EventHandler value)
Parameters:
  • value (System.EventHandler) –
public void Exit()
public void Dispose(bool disposing)
Parameters:
  • disposing (bool) –
public void Update(GameTime gameTime)
Parameters:
  • gameTime (Microsoft.Xna.Framework.GameTime) –
public void Draw(GameTime gameTime)
Parameters:
  • gameTime (Microsoft.Xna.Framework.GameTime) –
public void CloseRequested(ref bool cancel)
Parameters:
  • (ref) cancel (bool) –
public void PrepareGraphicsDeviceManager(GraphicsDeviceManager graphicsDeviceManager)

Prepares the graphics device manager.

If you want to change the initial size of the game window on startup, this is the place to do it. Override this method, and then set P:Microsoft.Xna.Framework.GraphicsDeviceManager.PreferredBackBufferWidth and P:Microsoft.Xna.Framework.GraphicsDeviceManager.PreferredBackBufferHeight.

Parameters:
  • graphicsDeviceManager (Microsoft.Xna.Framework.GraphicsDeviceManager) – The graphics device manager to prepare.
public void PrepareGameWindow(Protogame.IGameWindow window)

Prepares the game window.

If you want to change the initial position of the game window on startup, this is the place to do it. Override this method, and then set the window properties.

Parameters:
  • window (Protogame.IGameWindow) – The game window to prepare.
public void PrepareDeviceSettings(GraphicsDeviceInformation deviceInformation)

Prepares the graphics devices settings.

Parameters:
  • deviceInformation (Microsoft.Xna.Framework.GraphicsDeviceInformation) – The device information.