瀏覽代碼

Add Context Events

= 9 年之前
父節點
當前提交
18625d971a
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/babylon.engine.ts

+ 8 - 0
src/babylon.engine.ts

@@ -2588,6 +2588,14 @@
             this._loadingScreen.loadingUIBackgroundColor = color;
         }
 
+        public attachContextLostEvent(callback:((event: WebGLContextEvent) => void)) : void {
+            this._renderingCanvas.addEventListener("webglcontextlost", callback, false);
+        }
+
+        public attachContextRestoredEvent(callback:((event: WebGLContextEvent) => void)) : void {
+            this._renderingCanvas.addEventListener("webglcontextrestored", callback, false);
+        }
+
         // FPS
         public getFps(): number {
             return this.fps;