private void UpdateToolbarButtonsSizeAndPosition() { int buttonCount = 0; for (int index = 0; index < m_toolbarButtons.Length; index++) { MyGuiControlButton button = m_toolbarButtons[index]; if (button != null) { buttonCount++; } } Vector2 screenCoords = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate(new Vector2(MyMinerGame.ScreenSize.X, 0f)); var screenZero = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)); Vector2 buttonPosition = screenZero + MyGuiConstants.TOOLBAR_PADDING; float offset = MyGuiConstants.TOOLBAR_BUTTON_OFFSET; Vector2 buttonSize = MyGuiConstants.TOOLBAR_BUTTON_SIZE; float toolbarLength = buttonPosition.X + buttonCount * (buttonSize.X + offset); float scale = 1; if (toolbarLength > 1) { scale = screenCoords.X / toolbarLength; } //offset *= scale; buttonSize *= scale; Vector2 buttonOffset = new Vector2(buttonSize.X + offset, 0); int buttonIndexOffset = 0; for (int index = 0; index < m_toolbarButtons.Length; index++) { MyGuiControlButton button = m_toolbarButtons[index]; if (button != null) { button.SetPosition(buttonPosition + buttonOffset * buttonIndexOffset + buttonSize / 2); button.SetSize(buttonSize); button.SetTextScale(MyGuiConstants.TOOLBAR_TEXT_SCALE * scale); buttonIndexOffset++; } } }