OurSonic.SonicManager.debugDraw C# (CSharp) Method

debugDraw() private method

private debugDraw ( ) : void
return void
        private void debugDraw()
        {
            int numWide = 10;
            int dropOffIndex = 0;
            List<string> pieces = new List<string>();

            while (true)
            {
                List<CanvasInformation> debugCanvases = new List<CanvasInformation>();
                int totalHeight = 0;
                var broke = false;
                for (int index = dropOffIndex; index < SonicLevel.TileChunks.Count; index++)
                {
                    var chunk = SonicLevel.TileChunks[index];
                    var canvasCache = chunk.Debug_DrawCache();
                    totalHeight += canvasCache.Canvas.Height;
                    debugCanvases.Add(canvasCache);
                    if (totalHeight > 10000)
                    {
                        dropOffIndex = index + 1;
                        broke = true;
                        break;
                    }
                }

                var bigOne = CanvasInformation.Create(numWide * 128, totalHeight, false);
                int currentPosition = 0;
                for (int index = 0; index < debugCanvases.Count; index++)
                {
                    var canvasInformation = debugCanvases[index];
                    bigOne.Context.DrawImage(canvasInformation.Canvas, 0, currentPosition);
                    currentPosition += canvasInformation.Canvas.Height;
                }
                pieces.Add(bigOne.Canvas.Me().toDataURL());
                if (!broke) break;
            }

            var str = "<html><body>";
            foreach (var piece in pieces)
            {
                str += "<img src=\"" + piece + "\"/>\n";
            }
            str += "</body></html>";
            var tx = (TextAreaElement)Window.Document.CreateElement("textarea");
            tx.Style.Position = "absolute";
            tx.Value = str;
            Window.Document.Body.AppendChild(tx);
        }
    }