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
ControlThe Control the engine should draw onto.
config
EngineConfigSettings 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
- 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
Capabilities
Methods for determining the rendering capabilities of the graphics hardware.
public EngineCapabilities Capabilities { get; }
Property Value
Config
The settings the engine was initialized with.
public EngineConfig Config { get; set; }
Property Value
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
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
FadeExtra
Is ExtraRender faded along with the scene?
public bool FadeExtra { get; set; }
Property Value
FadeLevel
The level of scene fading from 0 (fully visible) to 255 (invisible).
public int FadeLevel { get; set; }
Property Value
LastFrameGameTime
How many seconds of game time have elapsed since the last frame started drawing.
public double LastFrameGameTime { get; }
Property Value
Music
Controls the playback of music (theme-selection, cross-fading, etc.)
public MusicManager Music { get; }
Property Value
NeedsReset
The engine will be reset on the next Render() call
public bool NeedsReset { get; }
Property Value
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
RenderSize
The size of the render target
public Size RenderSize { get; set; }
Property Value
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
ShaderDir
The base directory where shader files are stored
public string ShaderDir { get; }
Property Value
State
Used by Renderable implementations to manipulate the graphics render state. Should not be manipulated manually.
public EngineState State { get; }
Property Value
Target
The Control the engine draws onto.
[LuaHide]
public Control Target { get; }
Property Value
TotalGameTime
How many seconds of game time have elapsed in total.
public double TotalGameTime { get; }
Property Value
Version
The version number of the engine.
public static Version Version { get; }
Property Value
Views
A list of all views to be rendered by the engine
public ICollection<View> Views { get; }
Property Value
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
doubleHow many seconds of game time have elapsed since the last frame was drawn.
noPresent
booltrue
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
stringThe 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
stringThe file name to save the screenshot too
size
SizeThe 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
stringThe file name to save the screenshot too
width
intThe width to scale the resolution down too
height
intThe 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
DeviceReset
Occurs after the Device was reset. This needs to be done to continue using it after DeviceLost.
public event Action? DeviceReset
Event Type
ExtraRender
Allows the integration of external render processes at the end of the Engine's presentation scheme.
public event Action? ExtraRender
Event Type
PostRender
Occurs once for every frame after rendering
public event Action? PostRender
Event Type
PreRender
Occurs once for every frame before rendering.
public event Action? PreRender