Explorar o código

Add Context Events

= %!s(int64=9) %!d(string=hai) anos
pai
achega
18625d971a
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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;