@@ -9,7 +9,7 @@ import RuntimeMetrics from './RuntimeMetrics.js';
99import FrameClock from './FrameClock.js' ;
1010import FixedTicker from './FixedTicker.js' ;
1111import EventBus from '../events/EventBus.js' ;
12- import { AutoDiscoveredGameImageLayers , FullscreenService } from '../runtime/index.js' ;
12+ import { backgroundImage , fullscreenBezel , FullscreenService } from '../runtime/index.js' ;
1313import { AudioService } from '../audio/index.js' ;
1414import { Logger } from '../logging/index.js' ;
1515import { SettingsSystem } from '../release/index.js' ;
@@ -26,7 +26,8 @@ export default class Engine {
2626 frameClock = null ,
2727 fixedTicker = null ,
2828 fullscreen = null ,
29- autoImageLayers = null ,
29+ backgroundImageLayer = null ,
30+ fullscreenBezelLayer = null ,
3031 audio = null ,
3132 logger = null ,
3233 } = { } ) {
@@ -52,7 +53,11 @@ export default class Engine {
5253 documentRef : globalThis . document ?? null ,
5354 target : canvas ,
5455 } ) ;
55- this . autoImageLayers = autoImageLayers || new AutoDiscoveredGameImageLayers ( {
56+ this . backgroundImageLayer = backgroundImageLayer || new backgroundImage ( {
57+ documentRef : globalThis . document ?? null
58+ } ) ;
59+ this . fullscreenBezelLayer = fullscreenBezelLayer || new fullscreenBezel ( {
60+ canvas,
5661 documentRef : globalThis . document ?? null
5762 } ) ;
5863 this . audio = audio || new AudioService ( ) ;
@@ -102,6 +107,9 @@ export default class Engine {
102107 if ( this . fullscreen && typeof this . fullscreen . attach === 'function' ) {
103108 this . fullscreen . attach ( this . canvas ) ;
104109 }
110+ if ( this . fullscreenBezelLayer && typeof this . fullscreenBezelLayer . attach === 'function' ) {
111+ this . fullscreenBezelLayer . attach ( ) ;
112+ }
105113
106114 this . frameClock . reset ( ) ;
107115 this . fixedTicker . reset ( ) ;
@@ -123,6 +131,9 @@ export default class Engine {
123131 if ( this . fullscreen && typeof this . fullscreen . detach === 'function' ) {
124132 this . fullscreen . detach ( ) ;
125133 }
134+ if ( this . fullscreenBezelLayer && typeof this . fullscreenBezelLayer . detach === 'function' ) {
135+ this . fullscreenBezelLayer . detach ( ) ;
136+ }
126137 }
127138
128139 tick ( now ) {
@@ -149,12 +160,13 @@ export default class Engine {
149160 updateDurationMs = performance . now ( ) - updateStart ;
150161
151162 const renderStart = performance . now ( ) ;
152- this . autoImageLayers ?. renderBackground ?. ( this . renderer ) ;
163+ this . renderer . clear ( ) ;
164+ this . backgroundImageLayer ?. render ?. ( this . renderer ) ;
153165 if ( this . scene && typeof this . scene . render === 'function' ) {
154166 this . scene . render ( this . renderer , this ) ;
155167 }
156168 const fullscreenActive = this . fullscreen ?. getState ?. ( ) . active === true ;
157- this . autoImageLayers ?. renderBezel ?. ( this . renderer , { fullscreenActive } ) ;
169+ this . fullscreenBezelLayer ?. sync ?. ( { fullscreenActive } ) ;
158170 renderDurationMs = performance . now ( ) - renderStart ;
159171
160172 this . metrics . recordFrame ( {
0 commit comments