private MyGuiControlButton AddToolbarButton(EditorToolBarButtonType buttonType, MyTextsWrapperEnum text, StringBuilder tooltip, MyGuiControlButton.OnButtonClick onButtonClick) { var screenZero = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)); int index = 0; foreach (var item in m_toolbarButtons) { if (item != null) { index++; } } Vector2 buttonPosition = screenZero + MyGuiConstants.TOOLBAR_PADDING; Vector2 buttonSize = MyGuiConstants.TOOLBAR_BUTTON_SIZE; Vector2 buttonOffset = new Vector2(buttonSize.X + MyGuiConstants.TOOLBAR_BUTTON_OFFSET, 0); var button = new MyGuiControlButton( m_parentScreen, buttonPosition + buttonOffset * index, buttonSize, Vector4.One, MyGuiManager.GetToolbarButton(), MyGuiManager.GetToolbarButtonHover(), MyGuiManager.GetToolbarButtonHover(), text, MyGuiConstants.TOOLBAR_TEXT_COLOR, MyGuiConstants.TOOLBAR_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, onButtonClick, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, true, false); button.SetToolTip(tooltip); button.SetHightlightType(MyGuiControlHighlightType.WHEN_CURSOR_OVER); if (GetEnabledButtons().Contains(buttonType) && button != null) { m_editorControls.Add(button); m_toolbarButtons[(int)buttonType] = button; } return(button); }