From 38bac81994981cacb0bff9b79f7aa1604f916ad8 Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Thu, 29 Feb 2024 10:39:03 +0000 Subject: [PATCH] support graphics device being fed in --- src/framework/application.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/framework/application.js b/src/framework/application.js index 89564c2d9d1..cb587c4c250 100644 --- a/src/framework/application.js +++ b/src/framework/application.js @@ -108,6 +108,9 @@ class Application extends AppBase { * handler for input. * @param {string} [options.scriptPrefix] - Prefix to apply to script urls before loading. * @param {string} [options.assetPrefix] - Prefix to apply to asset urls before loading. + * @param {import('../platform/graphics/graphics-device.js').GraphicsDevice} [options.graphicsDevice] - The + * graphics device used by the application. If not provided, a WebGl graphics device will be + * created. * @param {object} [options.graphicsDeviceOptions] - Options object that is passed into the * {@link GraphicsDevice} constructor. * @param {string[]} [options.scriptsOrder] - Scripts in order of loading first. @@ -123,7 +126,7 @@ class Application extends AppBase { const appOptions = new AppOptions(); - appOptions.graphicsDevice = this.createDevice(canvas, options); + appOptions.graphicsDevice = options.graphicsDevice ?? this.createDevice(canvas, options); this.addComponentSystems(appOptions); this.addResourceHandles(appOptions);