I am trying to use the modules operator on the coordinates of my sprite (Spritex = Sprite.GetPosition().X % 16) and I am getting an error
Error: invalid operands of types 'const float' and 'int' to binary 'operator%'
I am on CodeBlocks and it doesnt matter what variable Spritex is, always getting an error
Help!
Sfml 1.6 Modules Operator Error
sf::Vector2f (returned by GetPosition()) is a vector of float types, 16 is an integer type. % wants them both to be integers. You can explicitly cast Sprite.GetPosition().X to int and it should work.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement