-
Notifications
You must be signed in to change notification settings - Fork 3
Simulation
The Simulation
class is the easiest way to setup an application using SimulationFramework.
class MySimulation : Simulation
{
public override OnInitialize(AppConfig config)
{
}
public override OnRender(ICanvas canvas)
{
}
}
Application Application { get; }
The simulation's application.
abstract void OnInitialize(AppConfig config);
OnInitialize is called after the simulation has been initialized, before any calls to OnRender. This is the first time that any static APIs can be used.
The config
parameter provides an AppConfig instance the simulation can use to properly configure the window or any needed features.
This method must be overridden by inheriting classes.
abstract void OnRender(ICanvas canvas);
This method is called once per frame, when the simulation needs to render.
The canvas
parameter provides the canvas that the simulation should render to. This is not guaranteed to be the window canvas.
This method must be overridden by inheriting classes.
virtual void OnUninitialize();
Called when the simulation is ending, after the final call to OnRender. No static APIs should be used here.
virtual void OnResize(int width, int height);
Called when the simulation is resized. The width and height parameters specify the new size of the simulation's window.
This method is always called before OnRender
.
void Run(IAppPlatform platform);
Starts a simulation, using the provided platform. This method returns only when the simulation stops running.