Skip to content

Commit ac23033

Browse files
author
Exoridus
committed
docs: add examples migration reference
1 parent 940cfb0 commit ac23033

4 files changed

Lines changed: 156 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Class-focused runtime docs live under [docs/api](docs/api/README.md).
9999
Key pages:
100100

101101
- [Application](docs/api/Application.md)
102+
- [Examples Migration](docs/api/ExamplesMigration.md)
102103
- [Scene](docs/api/Scene.md)
103104
- [Loader](docs/api/Loader.md)
104105
- [Renderer](docs/api/Renderer.md)

docs/api/ExamplesMigration.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Examples Migration
2+
3+
This page summarizes the ExoJS refactors that examples and integration code need to follow.
4+
5+
## Rendering flow
6+
7+
The normal rendering flow is now:
8+
9+
1. `Application` owns frame presentation.
10+
2. `Scene.update(delta)` mutates state.
11+
3. `Scene.draw(renderBackend)` submits drawables.
12+
4. `Application` calls `display()` on the active render runtime.
13+
14+
Use this in scene code:
15+
16+
```ts
17+
public draw(renderBackend: RenderBackend): void {
18+
this.root.render(renderBackend);
19+
}
20+
```
21+
22+
Do not use:
23+
24+
- `renderManager.draw(...)`
25+
- `renderManager.display()` from scene code
26+
27+
Use drawable submission instead:
28+
29+
- `drawable.render(renderBackend)`
30+
- `root.render(renderBackend)`
31+
32+
## View handling
33+
34+
View switching now has a stable runtime convenience:
35+
36+
```ts
37+
app.renderManager.setView(view);
38+
```
39+
40+
This forwards to the current render target:
41+
42+
```ts
43+
app.renderManager.renderTarget.setView(view);
44+
```
45+
46+
## Backend selection
47+
48+
`new Application()` now defaults to automatic backend selection:
49+
50+
- prefer WebGPU when available
51+
- fall back to WebGL2 when WebGPU is unavailable or initialization fails
52+
53+
Explicit backend selection still works:
54+
55+
```ts
56+
new Application({ backend: { type: 'webgpu' } });
57+
new Application({ backend: { type: 'webgl2' } });
58+
new Application({ backend: { type: 'auto' } });
59+
```
60+
61+
## Updated public type names
62+
63+
### Core
64+
65+
- `IApplicationOptions` -> `ApplicationOptions`
66+
- `IWebGl2BackendConfig` -> `WebGl2BackendConfig`
67+
- `IWebGpuBackendConfig` -> `WebGpuBackendConfig`
68+
- `IAutoBackendConfig` -> `AutoBackendConfig`
69+
- `ISceneData` -> `SceneData`
70+
71+
### Rendering
72+
73+
- `IRenderBackend` -> `RenderBackend`
74+
- `IRenderManager` -> `RenderRuntime`
75+
- `IRenderer` -> `Renderer`
76+
- `IWebGpuRenderAccess` -> `WebGpuRenderAccess`
77+
- `IWebGl2RenderBackend` -> `WebGl2RenderBackend`
78+
79+
### Resource and media contracts
80+
81+
- `IDatabase` -> `Database`
82+
- `IResourceFactory` -> `ResourceFactory`
83+
- `IMedia` -> `Media`
84+
- `IAbstractMediaInitialState` -> `AbstractMediaInitialState`
85+
86+
### Foundational math and shape contracts
87+
88+
- `ICloneable` -> `Cloneable`
89+
- `IDestroyable` -> `Destroyable`
90+
- `IWithBoundingBox` -> `HasBoundingBox`
91+
- `ICollidable` -> `Collidable`
92+
- `ICollisionResponse` -> `CollisionResponse`
93+
- `IShape` -> `ShapeLike`
94+
- `IPoint` -> `PointLike`
95+
- `ILine` -> `LineLike`
96+
- `IRectangle` -> `RectangleLike`
97+
- `ICircle` -> `CircleLike`
98+
- `IEllipse` -> `EllipseLike`
99+
- `IPolygon` -> `PolygonLike`
100+
- `IPlaybackOptions` -> `PlaybackOptions`
101+
102+
### Remaining option/runtime contracts cleaned up in this pass
103+
104+
- `IAudioAnalyserOptions` -> `AudioAnalyserOptions`
105+
- `ILoaderOptions` -> `LoaderOptions`
106+
- `IResourceQueueItem` -> `ResourceQueueItem`
107+
- `IResourceTypeMap` -> `ResourceTypeMap`
108+
- `IFontFactoryOptions` -> `FontFactoryOptions`
109+
- `ICreateCanvasOptions` -> `CreateCanvasOptions`
110+
- `ITextStyleOptions` -> `TextStyleOptions`
111+
- `ISamplerOptions` -> `SamplerOptions`
112+
- `ISpritesheetFrame` -> `SpritesheetFrame`
113+
- `ISpritesheetData` -> `SpritesheetData`
114+
- `IShaderRuntime` -> `ShaderRuntime`
115+
- `IRenderBufferRuntime` -> `RenderBufferRuntime`
116+
- `IVertexArrayObjectRuntime` -> `VertexArrayObjectRuntime`
117+
- `IParticleProperties` -> `ParticleProperties`
118+
- `IParticleEmitter` -> `ParticleEmitter`
119+
- `IParticleAffector` -> `ParticleAffector`
120+
121+
## Enum casing updates
122+
123+
Non-input public enum members now use PascalCase consistently.
124+
125+
Examples and integrations should update member access accordingly:
126+
127+
- `BlendModes.Normal`
128+
- `RendererType.Sprite`
129+
- `RenderingPrimitives.Triangles`
130+
- `ScaleModes.Linear`
131+
- `WrapModes.ClampToEdge`
132+
- `ApplicationStatus.Running`
133+
134+
## Input / gamepad changes
135+
136+
The input layer now uses ordered `GamepadDefinition[]` resolution.
137+
138+
Use:
139+
140+
- `gamepadDefinitions`
141+
142+
Do not use the removed older gamepad mapping/profile configuration path.
143+
144+
Canonical generic gamepad channel names are now the intended public surface:
145+
146+
- `ButtonSouth`
147+
- `ButtonEast`
148+
- `ButtonWest`
149+
- `ButtonNorth`
150+
- `LeftStickX`
151+
- `RightStickY`
152+
153+
Avoid platform-specific alias naming in new examples.

docs/api/Loader.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ await loader
1919

2020
## Key concepts
2121

22-
- `ILoaderOptions`
22+
- `LoaderOptions`
2323
- `ResourceFactory`
2424
- `ResourceContainer`
2525
- `Database`

docs/api/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This directory is the stable reference surface for the normal ExoJS runtime mode
55
Use these pages as the source of truth for examples and application code:
66

77
- [Application](./Application.md)
8+
- [Examples Migration](./ExamplesMigration.md)
89
- [Scene](./Scene.md)
910
- [Loader](./Loader.md)
1011
- [Renderer](./Renderer.md)

0 commit comments

Comments
 (0)