Skip to main content

Engine

Namespace: MonineEngine.Core

The core class for Monine Engine, handling updating, drawing, and management. Many instances one may need access to can likely be found here as a static field.

public class Engine : Microsoft.Xna.Framework.Game, System.IDisposable

Inheritance Object → Game → Engine
Implements IDisposable
Attributes NullableContextAttribute, NullableAttribute

Fields

Version

Gets a string representing the current version of Monine Engine. Represented as MAJOR.MINOR.PATCH.BUILD.

public static string Version;

Properties

WindowCenter

Gets the position of the center of the game window in screen space.

public Vector2 WindowCenter { get; }

Property Value

Vector2

WindowSize

Gets the bounds of the game window.

public Vector2 WindowSize { get; }

Property Value

Vector2

Instance

Gets the currently running instance of the engine.

public static Engine Instance { get; }

Property Value

Engine

ServiceProvider

Gets the of the current content manager. Identical to typing Engine.Instance.Content.ServiceProvider, and this merely acts as a shortcut.

public static IServiceProvider ServiceProvider { get; }

Property Value

IServiceProvider

DeviceManager

Gets the used to draw the game window.

public static GraphicsDeviceManager DeviceManager { get; private set; }

Property Value

GraphicsDeviceManager

NullTexture

Gets the texture of Monine Engine to be used when a Sprite has no defined .

public static Texture2D NullTexture { get; private set; }

Property Value

Texture2D

Remarks:

Depicts a 2x2 pixel texture with a pink and black checkerboard pattern. You can't miss it. Unless your game has pink and black checkerboard patterns.

Renderer

Gets the IRendererService of the engine.

public static IRendererService Renderer { get; private set; }

Property Value

IRendererService

GameWindow

Gets the Engine.GameWindow of the active .

public static GameWindow GameWindow { get; private set; }

Property Value

GameWindow

Remarks:

Viewport

Gets the Engine.Viewport of the current .

public static Viewport Viewport { get; private set; }

Property Value

Viewport

DrawBatchCount

Gets or sets amount of draw calls that have been called during the current draw loop. Resets when the loop begins.

public static int DrawBatchCount { get; internal set; }

Property Value

Int32

Remarks:

While this is only used for debugging/profiling, and has no effect on gameplay when changing, it is not recommended to change this yourself.

LaunchParameters

public LaunchParameters LaunchParameters { get; }

Property Value

LaunchParameters

Components

public GameComponentCollection Components { get; }

Property Value

GameComponentCollection

InactiveSleepTime

public TimeSpan InactiveSleepTime { get; set; }

Property Value

TimeSpan

MaxElapsedTime

public TimeSpan MaxElapsedTime { get; set; }

Property Value

TimeSpan

IsActive

public bool IsActive { get; }

Property Value

Boolean

IsMouseVisible

public bool IsMouseVisible { get; set; }

Property Value

Boolean

TargetElapsedTime

public TimeSpan TargetElapsedTime { get; set; }

Property Value

TimeSpan

IsFixedTimeStep

public bool IsFixedTimeStep { get; set; }

Property Value

Boolean

Services

public GameServiceContainer Services { get; }

Property Value

GameServiceContainer

Content

public ContentManager Content { get; set; }

Property Value

ContentManager

GraphicsDevice

public GraphicsDevice GraphicsDevice { get; }

Property Value

GraphicsDevice

Window

public GameWindow Window { get; }

Property Value

GameWindow

Constructors

Engine(Func<GraphicsDevice, IRendererService>, Scene, String, Boolean, Int32, Int32)

Constructs a new instance of the Monine Engine. Use to start it, and therefore the game.

public Engine(Func<GraphicsDevice, IRendererService> rendererFactory, Scene startingScene, string title, bool fullScreen, int width, int height)

Parameters

rendererFactory Func<GraphicsDevice, IRendererService>
A Func<TResult> that takes a and returns a RendererService.

startingScene Scene
The initial Scene to load into on boot.

title String
The title of the window. Can be changed mid-game.

fullScreen Boolean
If the window should be in fullscreen or not.

width Int32
The width of the window in pixels.

height Int32
The height of the window in pixels.

Methods

Initialize()

protected void Initialize()

LoadContent()

protected void LoadContent()

UnloadContent()

protected void UnloadContent()

Update(GameTime)

protected void Update(GameTime gameTime)

Parameters

gameTime GameTime

Draw(GameTime)

protected void Draw(GameTime gameTime)

Parameters

gameTime GameTime

SetWindowTitle(String)

Sets the title of the game window.

public void SetWindowTitle(string title)

Parameters

title String
The new title for the game window.

Events

Activated

public event EventHandler<EventArgs> Activated;

Deactivated

public event EventHandler<EventArgs> Deactivated;

Disposed

public event EventHandler<EventArgs> Disposed;

Exiting

public event EventHandler<ExitingEventArgs> Exiting;