Interface IApplication
The interface that user apps must implement. The framework calls the methods which define the broad program flow
Namespace: Yak2D
Assembly: Yak2D.Api.dll
Syntax
public interface IApplication
Methods
Configure()
The user should return the desired configuration properties. Called once
Declaration
StartupConfig Configure()
Returns
| Type | Description |
|---|---|
| StartupConfig |
CreateResources(IServices)
Called whenever framework related resources should be created, including once at start up and whenever resources are lost (such as graphics device change). An application should be able to restore all required resources at any moment this is called
Declaration
bool CreateResources(IServices yak)
Parameters
| Type | Name | Description |
|---|---|---|
| IServices | yak | Collection of framework user services |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Drawing(IDrawing, IFps, IInput, ICoordinateTransforms, Single, Single)
The user should populate Draw Request Queues here
Declaration
void Drawing(IDrawing draw, IFps fps, IInput input, ICoordinateTransforms transforms, float secondsSinceLastDraw, float secondsSinceLastUpdate)
Parameters
| Type | Name | Description |
|---|---|---|
| IDrawing | draw | Exposes methods used for updating draw queues |
| IFps | fps | Provides update and draw iteration FPS |
| IInput | input | Exposes framework input services. Whilst best practice input processing should be done in an update iteration (you will not get correct behaviour regarding whether a button or key was release or pressed 'this frame' for example, as these are tied to updates). Access to input here can be useful in some cases |
| ICoordinateTransforms | transforms | Provides functions to transform positions between World, Screen and Window coordinates |
| System.Single | secondsSinceLastDraw | Seconds since last draw iteration |
| System.Single | secondsSinceLastUpdate | Seconds since last update iteration |
OnStartup()
Called once on startup, prior to the intial resource creation call. The application may wish to implement one time, independent operations here
Declaration
void OnStartup()
PreDrawing(IServices, Single, Single)
Called ahead of Drawing. The user may wish to include preparatory steps here before drawing begins. Both time since last draw and update are provided. Time since last update could be used to interpolate positions to smooth motion
Declaration
void PreDrawing(IServices yak, float secondsSinceLastDraw, float secondsSinceLastupdate)
Parameters
| Type | Name | Description |
|---|---|---|
| IServices | yak | Collection of framework user services |
| System.Single | secondsSinceLastDraw | Seconds since last draw iteration |
| System.Single | secondsSinceLastupdate | Seconds since last update iteration |
ProcessMessage(FrameworkMessage, IServices)
If there are framework messages in the queue, ahead of an update call, this method is called once per message
Declaration
void ProcessMessage(FrameworkMessage msg, IServices yak)
Parameters
| Type | Name | Description |
|---|---|---|
| FrameworkMessage | msg | The framework message |
| IServices | yak | Collection of framework user services |
Rendering(IRenderQueue, IRenderTarget)
The user should build the frame's render pipeline here
Declaration
void Rendering(IRenderQueue q, IRenderTarget windowRenderTarget)
Parameters
| Type | Name | Description |
|---|---|---|
| IRenderQueue | q | Exposes methods used for building the render pipeline |
| IRenderTarget | windowRenderTarget | The RenderTarget reference of the current window's main rendering surface |
Shutdown()
Called when application is shutting down. User should release non-framework related resources here
Declaration
void Shutdown()
Update(IServices, Single)
Called when the user application should execute an update iteration. Return false to shutdown the application
Declaration
bool Update(IServices yak, float secondsSinceLastUpdate)
Parameters
| Type | Name | Description |
|---|---|---|
| IServices | yak | Collection of framework user services |
| System.Single | secondsSinceLastUpdate | Seconds since last update iteration |
Returns
| Type | Description |
|---|---|
| System.Boolean |