You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lib/Engine/Core.ts
+42-6
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,20 @@ import { CanvasRenderer } from "../Graphics/CanvasRenderer.js";
4
4
importRenderfrom"../Graphics/Renderer.js";
5
5
import{EngineTime,EngineTiming}from"./Timing.js";
6
6
7
-
enumENGINE_EVENTS{
7
+
/**
8
+
* The list of engine events.
9
+
*/
10
+
exportenumENGINE_EVENTS{
8
11
/**
9
-
*
12
+
* Called when the engine is started cold. This can either be on initial start, or after a full reset.
10
13
*/
11
14
awake="awake",
12
15
/**
13
-
*
16
+
* Called once per frame. Each registered event listener will be called in-order before rendering the frame.
14
17
*/
15
18
update="update",
16
19
/**
17
-
*
20
+
* Called after a frame has been rendered. Used to render custom graphics on top of the frame.
18
21
*/
19
22
customRender="customRender"
20
23
}
@@ -23,6 +26,35 @@ interface EngineEventBuckets {
23
26
[key: string]: Array<(...args: any[])=>void>;
24
27
}
25
28
29
+
/**
30
+
* An instance of the engine. This is where it all begins.
31
+
*
32
+
* Once attached to a canvas, the engine instance be started by calling {@link EntityEngine.start()}.
33
+
*
34
+
* The execution loop (event "update") and other engine events can be accessed by registering an event handler via {@link EntityEngine.addEventListener()}.
35
+
* Listeners will be called in-order, between each frame render. A special event is `customRender`, which is called *after* frame render,
36
+
* to allow custom elements to be rendered on top of the fresh frame.
37
+
*
38
+
* An initial setup would look something like this:
0 commit comments