admin管理员组

文章数量:1123351

buttonText.setPosition(
    position.x + (size.x - buttonText.getGlobalBounds().size.x) / 2,
    position.y + (size.y - buttonText.getGlobalBounds().size.y) / 2
);

position.x, position.y, size.x, size.y, buttonText.getGlobalBounds().size.x and buttonText.getGlobalBounds().size.y are float sf::Vector2f::x or float sf::Vector2f::y. So what's wrong in my code?

本文标签: cHow to center the text of the button in itStack Overflow