private ProfileGUI()
        {
            // define gui styles
            GUIStyle rootStyle = new GUIStyle();
            rootStyle.IsOpaque = false;

            GUIStyle scrollerStyle = new GUIStyle();
            scrollerStyle.IsOpaque = true;
            scrollerStyle.FillColor[CustomColor.ColorBase] = new Color(0, 0, 0, 150);
            scrollerStyle.HasBorder = true;
            scrollerStyle.BorderColor[CustomColor.ColorBase] = new Color(0, 0, 0, 200);
            scrollerStyle.Focusable = true;

            GUIMLTextStyle bodyStyle = new GUIMLTextStyle();
            bodyStyle.Alignment = TextAlignment.JustifyLeft;
            bodyStyle.TextColor[CustomColor.ColorBase] = Color.White;
            bodyStyle.SizeToText = true;
            bodyStyle.AutoSizeHeightOnly = true;
            bodyStyle.FontType = "Courier14";

            GUITextStyle textStyle = new GUITextStyle();
            textStyle.Alignment = TextAlignment.JustifyRight;
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.SizeToText = true;
            textStyle.FontType = "Courier14";

            // init gui controls
            _root = new GUIControl();
            _root.Style = rootStyle;
            _root.HorizSizing = HorizSizing.Width;
            _root.VertSizing = VertSizing.Height;

            _scroll = new GUIScroll();
            _scroll.Style = scrollerStyle;
            _scroll.HorizSizing = HorizSizing.Relative;
            _scroll.VertSizing = VertSizing.Relative;
            _scroll.Position = new Vector2(10.0f, 10.0f);
            _scroll.Size = new Vector2(GUICanvas.Instance.Size.X - 20.0f, GUICanvas.Instance.Size.Y - 20.0f);
            _scroll.FocusOnWake = true;
            _scroll.Visible = true;
            _scroll.Folder = _root;
            _scroll.InputMap = new InputMap();

            int gamepadId = InputManager.Instance.FindDevice("gamepad0");
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Left, _OnLeft);
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Right, _OnRight);
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Start, _OnStart);

            _page = new GUIText();
            _page.Style = textStyle;
            _page.HorizSizing = HorizSizing.Relative;
            _page.VertSizing = VertSizing.Relative;
            _page.Position = new Vector2(GUICanvas.Instance.Size.X - 180.0f, 40.0f);
            _page.Text = string.Empty;
            _page.Visible = true;
            _page.Folder = _root;

            _saveToFile = new GUIText();
            _saveToFile.Style = textStyle;
            _saveToFile.HorizSizing = HorizSizing.Relative;
            _saveToFile.VertSizing = VertSizing.Relative;
            _saveToFile.Position = new Vector2(GUICanvas.Instance.Size.X - 260, 20.0f);
            _saveToFile.Text = string.Empty;
            #if !XBOX
            _saveToFile.Visible = true;
            _saveToFile.Folder = _root;
            #endif // !XBOX

            _text = new GUIMLText();
            _text.Style = bodyStyle;
            _text.HorizSizing = HorizSizing.Width;
            _text.VertSizing = VertSizing.Height;
            _text.Position = new Vector2(3.0f, 3.0f);
            _text.Size = new Vector2(GUICanvas.Instance.Size.X - 40.0f, GUICanvas.Instance.Size.Y - 20.0f);
            _text.Text = "Torque X Profiler\n\nNo profiles have been taken yet.\nPress (F2) to take a snapshot since the last profile.\n\nIf the profiler doesn't seem to be responding, there may be a stack overflow. Make sure that \nfor each StartBlock call there is an EndBlock call. If the code you're profiling has multiple \nreturn paths you will need multiple EndBlock calls: one before each return statement. If \nthis is an issue, try profiling with a debug build to catch the overflow assert (you might \nneed to run your app for a while before you get it, depending on the cause of the overflow).\n\nEnjoy! ;)";
            _text.Visible = true;
            _text.Folder = _scroll;
        }
        /// <summary>
        /// Initializes the console gui.
        /// </summary>
        public void Initialize()
        {
            if (_isInitialized)
            {
                TorqueConsole.Warn("ConsoleGui.InitializeGui - Gui is already initialized!");
                return;
            }

            // define gui styles
            GUIStyle rootStyle = new GUIStyle();
            rootStyle.IsOpaque = true;
            rootStyle.FillColor[CustomColor.ColorBase] = new Color(0, 0, 0, 128);

            GUIStyle scrollerStyle = new GUIStyle();
            scrollerStyle.HasBorder = true;
            scrollerStyle.BorderColor[CustomColor.ColorBase] = new Color(0, 0, 0, 255);
            scrollerStyle.Focusable = false;

            GUIMLTextStyle bodyStyle = new GUIMLTextStyle();
            bodyStyle.Alignment = TextAlignment.JustifyLeft;
            bodyStyle.TextColor[CustomColor.ColorUser0] = Color.White;
            bodyStyle.TextColor[CustomColor.ColorUser1] = Color.Yellow;
            bodyStyle.TextColor[CustomColor.ColorUser2] = Color.Red;
            bodyStyle.SizeToText = true;
            bodyStyle.AutoSizeHeightOnly = false;
            bodyStyle.FontType = "Arial12";

            GUITextStyle textStyle = new GUITextStyle();
            textStyle.Alignment = TextAlignment.JustifyLeft;
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.SizeToText = false;
            textStyle.Focusable = true;
            textStyle.FontType = "Arial14";

            // init gui controls
            _root = new GUIControl();
            _root.Style = rootStyle;
            _root.HorizSizing = HorizSizing.Width;
            _root.VertSizing = VertSizing.Height;
            _root.Size = new Vector2(GUICanvas.Instance.Size.X, GUICanvas.Instance.Size.Y);

            _scroll = new GUIScroll();
            _scroll.Style = scrollerStyle;
            _scroll.HorizSizing = HorizSizing.Width;
            _scroll.VertSizing = VertSizing.Relative;
            _scroll.Size = new Vector2(GUICanvas.Instance.Size.X, GUICanvas.Instance.Size.Y - 30.0f);
            _scroll.Visible = true;
            _scroll.Folder = _root;

            _textEdit = new GUIConsoleTextEdit();
            _textEdit.Style = textStyle;
            _textEdit.HorizSizing = HorizSizing.Relative;
            _textEdit.VertSizing = VertSizing.Relative;
            _textEdit.Position = new Vector2(10.0f, GUICanvas.Instance.Size.Y - 30.0f);
            _textEdit.Size = new Vector2(GUICanvas.Instance.Size.X - 20.0f, 30.0f);
            _textEdit.FocusOnWake = true;
            _textEdit.Visible = true;
            _textEdit.Folder = _root;
            _textEdit.OnValidateText = _ValidateText;

            int keyboardId = InputManager.Instance.FindDevice("keyboard");
            _textEdit.InputMap.BindAction(keyboardId, (int)Keys.Up, _NextHistory);
            _textEdit.InputMap.BindAction(keyboardId, (int)Keys.Down, _PreviousHistory);

            _text = new GUIConsoleText();
            _text.Style = bodyStyle;
            _text.HorizSizing = HorizSizing.Relative;
            _text.VertSizing = VertSizing.Relative;
            _text.Position = new Vector2(10.0f, 10.0f);
            _text.Size = new Vector2(400.0f, 20.0f);
            _text.Visible = true;
            _text.Folder = _scroll;
            _text.Text = _consoleText;

            _isInitialized = true;
        }