Я хочу точно установить положение sf :: Text в SFML 2.4.1, но после того, как я установил шрифт, его местоположение не подходит.Почему объект типа sf :: Text возвращает разные getPosition(). Y и getLocalBounds(). Top?
#include <SFML/Graphics.hpp>
#include <iostream>
#include <stdlib.h>
int main()
{
sf::Text text;
text.setCharacterSize(24);
sf::Font font;
font.loadFromFile("Font.ttf"); //without loading any font, everything's correct
text.setFont(font);
text.setString("A String");
text.setPosition(0, 61);
std::cout << text.getOrigin().y;
std::cout << text.getPosition().y;
std::cout << text.getGlobalBounds().top;
std::cout << text.getLocalBounds().top;
if (text.getLocalBounds().top != text.getPosition().y) return -1;
return 0;
}
Я попытался изменить происхождение, но это не помогло.
text.setOrigin(0, text.getGlobalBounds().height/2.f); //height is correct and it matches with what displays on the screen(draw code is unnecessary)
Любые мысли, почему?