|
| 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. |
0 commit comments