public void RecordCurrentFrameRenderBreaks() { var list = FlatRedBall.Graphics.Renderer.LastFrameRenderBreakList; FrameRecordViewModel viewModel = new FrameRecordViewModel(); viewModel.Time = TimeManager.CurrentTime; foreach (var runtime in list) { RenderBreakSave save = RenderBreakSave.FromRenderBreak(runtime); viewModel.RenderBreaks.Add(save); } RecordedFrames.Add(viewModel); }
private void AddLineFor(FrameRecordViewModel newBreak, FrameRecordViewModel previous) { var line = new Line(); // Let's try making this a little thicker so it's easier to read, but transparent so it shows some of the lines behind it byte alpha = 100; Brush brush = new SolidColorBrush(Color.FromArgb(alpha, 0, 0, 0)); line.Stroke = brush; line.StrokeThickness = 5; line.X1 = 0; line.X2 = ViewModel.TimeToX(newBreak.Time); line.Y1 = CountToY(newBreak.RenderBreaks.Count); line.Y2 = line.Y1; if (line.X2 > MainCanvas.Width || double.IsNaN(MainCanvas.Width)) { MainCanvas.Width = line.X2; this.ScrollViewer.ScrollToRightEnd(); } if(previous != null) { line.X1 = ViewModel.TimeToX(previous.Time); line.Y1 = CountToY(previous.RenderBreaks.Count); } lineList.Add(line); this.MainCanvas.Children.Add(line); }
private void ExtendExistingLineFor(FrameRecordViewModel newFrame) { var lastLine = lineList.LastOrDefault(); if(lastLine != null) { lastLine.X2 = ViewModel.TimeToX(newFrame.Time); lastLine.Y2 = CountToY(newFrame.RenderBreaks.Count); if(double.IsNaN( MainCanvas.Height) || lastLine.Y2 > MainCanvas.Height) { MainCanvas.Height = lastLine.Y2; } if (lastLine.X2 > MainCanvas.Width || double.IsNaN(MainCanvas.Width)) { MainCanvas.Width = lastLine.X2; this.ScrollViewer.ScrollToRightEnd(); } } }