Hey, I'm attempting to use the sf::Rect class to check for intersections between two sprites. The problem appears when I actually call the intersects method for the class in that I get this error:
c:\sfml\include\sfml\graphics\rect.inl(104): error C2589: '(' : illegal token on right side of '::'
1> c:\sfml\include\sfml\graphics\rect.inl(102) : while compiling class template member function 'bool sf::Rect<T>::intersects(const sf::Rect<T> &,sf::Rect<T> &) const'
1> with
1> [
1> T=float
1> ]
1> c:\sfml\include\sfml\graphics\rect.inl(95) : see reference to function template instantiation 'bool sf::Rect<T>::intersects(const sf::Rect<T> &,sf::Rect<T> &) const' being compiled
1> with
1> [
1> T=float
1> ]
1> c:\sfml\include\sfml\graphics\rect.inl(28) : while compiling class template member function 'sf::Rect<T>::Rect(void)'
1> with
1> [
1> T=float
1> ]
1> c:\users\username\documents\visual studio 2012\projects\brickbreak\brickbreak\ball.cpp(6) : see reference to function template instantiation 'sf::Rect<T>::Rect(void)' being compiled
1> with
1> [
1> T=float
1> ]
1>c:\sfml\include\sfml\graphics\rect.inl(104): error C2059: syntax error : '::'
1>c:\sfml\include\sfml\graphics\rect.inl(105): error C2589: '(' : illegal token on right side of '::'
1>c:\sfml\include\sfml\graphics\rect.inl(105): error C2059: syntax error : '::'
1>c:\sfml\include\sfml\graphics\rect.inl(106): error C2589: '(' : illegal token on right side of '::'
1>c:\sfml\include\sfml\graphics\rect.inl(106): error C2059: syntax error : '::'
1>c:\sfml\include\sfml\graphics\rect.inl(107): error C2589: '(' : illegal token on right side of '::'
1>c:\sfml\include\sfml\graphics\rect.inl(107): error C2059: syntax error : '::'
Here's the code to create the rectangles:
bRect = sprite.getGlobalBounds();
pRect = sprite.getGlobalBounds();
And here's the actual call to the intersects method:
if(bRect.intersects(player.pRect) == true)
{
std::cout << "Hello";
}
Anybody able to help me out on this one?