private void InitGameComponents() { LabelControl ColumnTitles; ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(10.0f, 5.0f, 110.0f, 18.0f); ColumnTitles.Text = "Comp. type"; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(200.0f, 5.0f, 90.0f, 18.0f); ColumnTitles.Text = "Updating"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Clicked += ColumnTitlesUpdating_Clicked; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(290.0f, 5.0f, 110.0f, 18.0f); ColumnTitles.Text = "Drawing"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Clicked += ColumnTitlesDrawing_Clicked; Children.Add(ColumnTitles); _vsc = ToDispose(new VerticalSliderControl()); _vsc.Bounds = new UniRectangle(this.Bounds.Size.X - 20, 30.0f, 15.0f, this.Bounds.Size.Y - 35); _vsc.LayoutFlags = ControlLayoutFlags.WholeRow; _vsc.Moved += new EventHandler(_vsc_Moved); _vsc.ThumbSmoothMovement = true; _vsc.ThumbMinValue = 0; Children.Add(_vsc); float y = 25f; //Create the 20 components lists for (int i = 0; i < _nbrRowsToShow; i++) { Rows.Add(new GameComponentControlRow(this, y)); y = y + Step; } RefreshDataGrid(); }
private void InitGameComponents() { _displayResultsColumnPosi[(int)LabelResultColumn.Component] = 10; _displayResultsColumnPosi[(int)LabelResultColumn.AvgUpdt] = 160; _displayResultsColumnPosi[(int)LabelResultColumn.MaxUpdt] = 220; _displayResultsColumnPosi[(int)LabelResultColumn.AvgDraw] = 290; _displayResultsColumnPosi[(int)LabelResultColumn.MaxDraw] = 350; int y = 10; OptionControl oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 70.0f, 16.0f); oc.Text = "Perf tracing"; oc.Changed += (sender, e) => { _game.ComponentsPerfMonitor.Updatable = !_game.ComponentsPerfMonitor.Updatable; }; oc.Selected = _game.ComponentsPerfMonitor.Updatable; Children.Add(oc); oc = ToDispose(new OptionControl()); oc.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 100, y, 70.0f, 16.0f); oc.Text = "Avg in %"; oc.Changed += (sender, e) => { _showInPercent = !_showInPercent; }; oc.Selected = _showInPercent; Children.Add(oc); ButtonControl bc = ToDispose(new ButtonControl()); bc.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 170, y, 70.0f, 16.0f); bc.Text = "Reset Max"; bc.Pressed += (sender, e) => { _game.ComponentsPerfMonitor.PerfTimer.ResetMinMax(); }; Children.Add(bc); y += 15; LabelControl ColumnTitles; ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Regular; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 110.0f, 18.0f); ColumnTitles.Text = "Avg Frame time :"; Children.Add(ColumnTitles); _avgFrameTime = ToDispose(new LabelControl()); _avgFrameTime.FontStyle = System.Drawing.FontStyle.Regular; _avgFrameTime.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 90, y, 110.0f, 18.0f); _avgFrameTime.Text = "xxx fps"; Children.Add(_avgFrameTime); _vsc = ToDispose(new VerticalSliderControl()); _vsc.Bounds = new UniRectangle(this.Bounds.Size.X - 20, y + 25, 15.0f, 150.0f); _vsc.LayoutFlags = ControlLayoutFlags.WholeRow; _vsc.Moved += new EventHandler(_vsc_Moved); _vsc.ThumbSmoothMovement = true; _vsc.ThumbMinValue = 0; Children.Add(_vsc); y += 15; ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 50.0f, 18.0f); ColumnTitles.Text = "Component"; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.AvgUpdt], y, 50.0f, 18.0f); ColumnTitles.Text = "Avg Updt"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Tag = LabelResultColumn.AvgUpdt; ColumnTitles.Clicked += ColumnTitles_Clicked; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.MaxUpdt], y, 50.0f, 18.0f); ColumnTitles.Text = "Max Updt"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Tag = LabelResultColumn.MaxUpdt; ColumnTitles.Clicked += ColumnTitles_Clicked; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.AvgDraw], y, 50.0f, 18.0f); ColumnTitles.Text = "Avg Draw"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Tag = LabelResultColumn.AvgDraw; ColumnTitles.Clicked += ColumnTitles_Clicked; Children.Add(ColumnTitles); ColumnTitles = ToDispose(new LabelControl()); ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold; ColumnTitles.Bounds = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.MaxDraw], y, 50.0f, 18.0f); ColumnTitles.Text = "Max Draw"; ColumnTitles.Color = SharpDX.Color.DarkBlue; ColumnTitles.Tag = LabelResultColumn.MaxDraw; ColumnTitles.Clicked += ColumnTitles_Clicked; Children.Add(ColumnTitles); y += 15; //Create the result Array LabelControl lc; int arrayLinePosition; for (int column = 0; column < _displayedResults.GetLength(0); column++) { arrayLinePosition = y; for (int line = 0; line < _displayedResults.GetLength(1); line++) { lc = ToDispose(new LabelControl()); lc.Bounds = new UniRectangle(_displayResultsColumnPosi[column], arrayLinePosition, 50, 18); lc.Text = ""; Children.Add(lc); _displayedResults[column, line] = lc; arrayLinePosition += 15; } } }