Table of Contents

Class Engine

Namespace
OmegaEngine
Assembly
OmegaEngine.dll

Provides central control for 3D rendering, sound management, asset caching, etc.

public sealed class Engine : EngineElement, IDisposable
Inheritance
Engine
Implements
Inherited Members
Extension Methods

Constructors

Engine(Control, EngineConfig)

Initializes the Engine and its components.

public Engine(Control target, EngineConfig config)

Parameters

target Control

The Control the engine should draw onto.

config EngineConfig

Settings for initializing the engine.

Exceptions

NotSupportedException

The graphics card does not meet the engine's minimum requirements.

Direct3D9NotFoundException

Throw if required DirectX version is missing.

Direct3DX9NotFoundException

Throw if required DirectX version is missing.

Direct3D9Exception

Internal errors occurred while initializing the graphics card.

DirectSoundException

Internal errors occurred while initializing the sound card.

Properties

Anisotropic

Use anisotropic texture filtering

public bool Anisotropic { get; set; }

Property Value

bool
See Also

AudioDevice

The DirectSound device

[LuaHide]
public DirectSound AudioDevice { get; }

Property Value

DirectSound

Cache

The central cache used for all graphics and sound assets.

public CacheManager Cache { get; }

Property Value

CacheManager

Capabilities

Methods for determining the rendering capabilities of the graphics hardware.

public EngineCapabilities Capabilities { get; }

Property Value

EngineCapabilities

Config

The settings the engine was initialized with.

public EngineConfig Config { get; set; }

Property Value

EngineConfig

Remarks

Changing this will cause the engine to reset on the next Render() call

DefaultShader

A shader used for default lighting

public GeneralShader DefaultShader { get; }

Property Value

GeneralShader

Device

The Direct3D device. Use State instead of manipulating this directly when possible.

[LuaHide]
public Device Device { get; }

Property Value

Device

Effects

Turn specific rendering effects in the engine on or off.

public EngineEffects Effects { get; }

Property Value

EngineEffects

FadeExtra

Is ExtraRender faded along with the scene?

public bool FadeExtra { get; set; }

Property Value

bool

FadeLevel

The level of scene fading from 0 (fully visible) to 255 (invisible).

public int FadeLevel { get; set; }

Property Value

int

LastFrameGameTime

How many seconds of game time have elapsed since the last frame started drawing.

public double LastFrameGameTime { get; }

Property Value

double

Music

Controls the playback of music (theme-selection, cross-fading, etc.)

public MusicManager Music { get; }

Property Value

MusicManager

NeedsReset

The engine will be reset on the next Render() call

public bool NeedsReset { get; }

Property Value

bool

Remarks

Do not try to add new assets while this is true!

Just run Render() to fix the problem.

Performance

Tracks the performance/speed of the engine.

public EnginePerformance Performance { get; }

Property Value

EnginePerformance

RenderSize

The size of the render target

public Size RenderSize { get; set; }

Property Value

Size

RenderViewport

The viewport for the render target

public Viewport RenderViewport { get; }

Property Value

Viewport

ResourceCulture

The culture used for loading the assembly resources.

public static CultureInfo ResourceCulture { get; set; }

Property Value

CultureInfo

ShaderDir

The base directory where shader files are stored

public string ShaderDir { get; }

Property Value

string

State

Used by Renderable implementations to manipulate the graphics render state. Should not be manipulated manually.

public EngineState State { get; }

Property Value

EngineState

Target

The Control the engine draws onto.

[LuaHide]
public Control Target { get; }

Property Value

Control

TotalGameTime

How many seconds of game time have elapsed in total.

public double TotalGameTime { get; }

Property Value

double

Version

The version number of the engine.

public static Version Version { get; }

Property Value

Version

Views

A list of all views to be rendered by the engine

public ICollection<View> Views { get; }

Property Value

ICollection<View>

Remarks

Will be disposed when Dispose() is called.

Methods

Debug()

Displays a debug interface for the engine, allowing easy manipulation of Views, Renderable, etc.

public void Debug()

DebugClose()

Closes the windows displayed by Debug()

public void DebugClose()

OnDispose()

Hook that is called when the object needs to dispose its internal resources.

protected override void OnDispose()

Render()

Renders all Views. Tracks elapsed game time automatically.

public void Render()

Render(double, bool)

Renders all Views. Uses external game time tracking.

public void Render(double elapsedGameTime, bool noPresent = false)

Parameters

elapsedGameTime double

How many seconds of game time have elapsed since the last frame was drawn.

noPresent bool

true to suppress actually displaying the render output at the end.

Screenshot(string)

Saves the current screen at it's current resolution

public void Screenshot(string filename)

Parameters

filename string

The file name to save the screenshot too

Screenshot(string, Size)

Saves the current screen at a scaled resolution

public void Screenshot(string filename, Size size)

Parameters

filename string

The file name to save the screenshot too

size Size

The size to scale the resolution down too

Screenshot(string, int, int)

Saves the current screen at a scaled resolution as JPG

public void Screenshot(string filename, int width, int height)

Parameters

filename string

The file name to save the screenshot too

width int

The width to scale the resolution down too

height int

The height to scale the resolution down too

Events

DeviceLost

Occurs after the Device was lost. This usually happens when switching to or from fullscreen mode.

public event Action? DeviceLost

Event Type

Action

DeviceReset

Occurs after the Device was reset. This needs to be done to continue using it after DeviceLost.

public event Action? DeviceReset

Event Type

Action

ExtraRender

Allows the integration of external render processes at the end of the Engine's presentation scheme.

public event Action? ExtraRender

Event Type

Action

PostRender

Occurs once for every frame after rendering

public event Action? PostRender

Event Type

Action

PreRender

Occurs once for every frame before rendering.

public event Action? PreRender

Event Type

Action