SFML community forums

Bindings - other languages => D => Topic started by: Luhrel on April 07, 2016, 08:09:37 pm

Title: Unable to set position
Post by: Luhrel on April 07, 2016, 08:09:37 pm
Hello.

In my code when I do:
mySprite.position = new Vector2(x, y);

I have this error:
Error: struct dsfml.system.vector2.Vector2(T) if (isNumeric!T) is used as a type
dmd failed with exit code 1.

x and y are int.

What's incorrect ? What should I do ?

i'm using DSFML 2.1
Title: Re: Unable to set position
Post by: picnic on April 07, 2016, 10:27:26 pm
I think the answer is here:

http://www.sfml-dev.org/documentation/2.0/classsf_1_1Vector2.php#details

"the most common specializations have special typedefs:

    sf::Vector2<float> is sf::Vector2f
    sf::Vector2<int> is sf::Vector2i
"

Title: Re: Unable to set position
Post by: Luhrel on April 08, 2016, 10:59:36 am
Yes, it's:
mySprite.position = Vector2f(x, y);