11import * as ex from 'excalibur' ;
22import Engine from './engine.js' ;
33
4+ const spriteImage = new ex . ImageSource ( 'sprite.png' ) ;
5+
6+ const loader = new ex . Loader ( [ spriteImage ] ) ;
7+
48export class Scene extends ex . Scene {
59 particles = [ ] ;
610 onActivate ( ctx ) {
@@ -83,12 +87,12 @@ class ExcaliburEngine extends Engine {
8387 window . cancelAnimationFrame ( this . request ) ;
8488 if ( this . game ) {
8589 this . game . dispose ( ) ;
86- this . canvas = document . createElement ( " canvas" ) ;
87- this . canvas . id = " canvas" ;
88- this . canvas . className = " canvas" ;
90+ this . canvas = document . createElement ( ' canvas' ) ;
91+ this . canvas . id = ' canvas' ;
92+ this . canvas . className = ' canvas' ;
8993 this . canvas . width = this . width ;
9094 this . canvas . height = this . height ;
91- document . querySelector ( " main" ) . appendChild ( this . canvas ) ;
95+ document . querySelector ( ' main' ) . appendChild ( this . canvas ) ;
9296 }
9397
9498 const game = new ex . Engine ( {
@@ -97,12 +101,13 @@ class ExcaliburEngine extends Engine {
97101 canvasElement : this . canvas ,
98102 physics : false , // this benchmark is only doing drawing
99103 backgroundColor : ex . Color . fromRGB ( 26 , 26 , 26 ) ,
100- scenes : { scene : Scene }
104+ suppressPlayButton : true ,
105+ scenes : { scene : Scene } ,
101106 } ) ;
102107 this . game = game ;
103108 }
104109 render ( ) {
105- this . game . start ( ) . then ( ( ) => {
110+ this . game . start ( loader ) . then ( ( ) => {
106111 this . game . goToScene ( 'scene' , { sceneActivationData : { engine : this } } ) ;
107112 } ) ;
108113 }
0 commit comments