diff --git a/src/flambe/platform/Renderer.hx b/src/flambe/platform/Renderer.hx index 485497b8..611bec38 100644 --- a/src/flambe/platform/Renderer.hx +++ b/src/flambe/platform/Renderer.hx @@ -39,4 +39,9 @@ interface Renderer * Notifies the renderer that drawing the frame is complete. */ function didRender () :Void; + + /** + * Get the name of the renderer, for debug logging. + */ + function getName () :String; } diff --git a/src/flambe/platform/flash/FlashPlatform.hx b/src/flambe/platform/flash/FlashPlatform.hx index 1d8ff23b..89c23bc7 100644 --- a/src/flambe/platform/flash/FlashPlatform.hx +++ b/src/flambe/platform/flash/FlashPlatform.hx @@ -36,8 +36,6 @@ class FlashPlatform public function init () { - Log.info("Initializing Flash platform"); - var stage = Lib.current.stage; _stage = new FlashStage(stage); @@ -84,6 +82,8 @@ class FlashPlatform _lastUpdate = Lib.getTimer(); _skipFrame = false; _timeOffset = Date.now().getTime() - Lib.getTimer(); + + Log.info("Initialized Flash platform", ["renderer", _renderer.getName()]); } public function loadAssetPack (manifest :Manifest) :Promise diff --git a/src/flambe/platform/flash/Stage3DRenderer.hx b/src/flambe/platform/flash/Stage3DRenderer.hx index d0c3dca9..3def9e5a 100644 --- a/src/flambe/platform/flash/Stage3DRenderer.hx +++ b/src/flambe/platform/flash/Stage3DRenderer.hx @@ -107,6 +107,11 @@ class Stage3DRenderer #end } + public function getName () :String + { + return "Stage3D"; + } + private function onContext3DCreate (event :Event) { var stage3D :Stage3D = event.target; diff --git a/src/flambe/platform/html/CanvasRenderer.hx b/src/flambe/platform/html/CanvasRenderer.hx index 675481a2..707f53f3 100644 --- a/src/flambe/platform/html/CanvasRenderer.hx +++ b/src/flambe/platform/html/CanvasRenderer.hx @@ -54,6 +54,11 @@ class CanvasRenderer { } + public function getName () :String + { + return "Canvas"; + } + /** If true, blit loaded images to a canvas and use that as the texture. */ private static var CANVAS_TEXTURES :Bool = (function () { // On iOS, canvas textures are way faster diff --git a/src/flambe/platform/html/HtmlPlatform.hx b/src/flambe/platform/html/HtmlPlatform.hx index d554a15b..29cd1148 100644 --- a/src/flambe/platform/html/HtmlPlatform.hx +++ b/src/flambe/platform/html/HtmlPlatform.hx @@ -29,8 +29,6 @@ class HtmlPlatform public function init () { - Log.info("Initializing HTML platform"); - var canvas :CanvasElement = null; try { // Use the canvas assigned to us by the flambe.js embedder @@ -243,6 +241,8 @@ class HtmlPlatform update(HtmlUtil.now()); }, 16); // ~60 FPS } + + Log.info("Initialized HTML platform", ["renderer", _renderer.getName()]); } public function loadAssetPack (manifest :Manifest) :Promise @@ -391,13 +391,11 @@ class HtmlPlatform private function createRenderer (canvas :CanvasElement) :Renderer { -#if flambe_enable_webgl var gl = canvas.getContextWebGL({alpha: false, depth: false}); if (gl != null) { return new WebGLRenderer(_stage, gl); } - Log.info("WebGL not available, falling back to canvas"); -#end + // No WebGL, fall back to canvas return new CanvasRenderer(canvas); } diff --git a/src/flambe/platform/html/WebGLRenderer.hx b/src/flambe/platform/html/WebGLRenderer.hx index e6d87079..6b318d2b 100644 --- a/src/flambe/platform/html/WebGLRenderer.hx +++ b/src/flambe/platform/html/WebGLRenderer.hx @@ -21,8 +21,6 @@ class WebGLRenderer public function new (stage :HtmlStage, gl :RenderingContext) { - Log.info("Using experimental WebGL renderer", ["version", gl.getParameter(GL.VERSION)]); - this.gl = gl; // Handle GL context loss @@ -86,6 +84,11 @@ class WebGLRenderer batcher.didRender(); } + public function getName () :String + { + return "WebGL"; + } + private function onResize () { var width = gl.canvas.width;