- Notifications
You must be signed in to change notification settings - Fork 4
Simulation
The Simulation class is the easiest way to setup an application using SimulationFramework.
classMySimulation:Simulation{publicoverrideOnInitialize(AppConfigconfig){}publicoverrideOnRender(ICanvascanvas){}}ApplicationApplication{get;}The simulation's application.
abstractvoidOnInitialize(AppConfigconfig);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.
abstractvoidOnRender(ICanvascanvas);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.
virtualvoidOnUninitialize();Called when the simulation is ending, after the final call to OnRender. No static APIs should be used here.
virtualvoidOnResize(intwidth,intheight);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.
voidRun(IAppPlatformplatform);Starts a simulation, using the provided platform. This method returns only when the simulation stops running.