SFML: Vector2<double> 无法编译

SFML: Vector2<double> can't compile

我有无法编译的代码。如果我用 sf::Vector2f 替换 sf::Vector2<double>,它工作正常。我试过 typedef,但没有任何区别。

#include <SFML/Graphics.hpp>

int main() {
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");

    sf::Vertex line[] =
    {       
        sf::Vertex(sf::Vector2<double>(10.0, 10.0)),
        sf::Vertex(sf::Vector2<double>(150.0, 150.0))
    };

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }

        window.clear();
        window.draw(line, 2, sf::Lines);
        window.display();
    }

    return 0;
}

第一个错误:

test.cpp: In function ‘int main()’:
test.cpp:9:47: error: no matching function for call to ‘sf::Vertex::Vertex(sf::Vector2<double>)’

sf::Vertex 构造函数不接受双精度向量,只接受浮点向量。见 documentation.