Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - CG13

Pages: [1]
1
Graphics / Re: Issues with intersects
« on: May 11, 2013, 01:51:14 pm »
Ha, that's it!
I compared the changes from 1.6 to 2.0 and I don't know why I was thinking, that width and height are still koordinates instead of scalars relativ to the top and left..

And yes Nexus, for obvious reasons that would be.. prettier.. and easier.. better overall.

Thanks!

2
Graphics / Issues with intersects
« on: May 11, 2013, 01:41:27 pm »
Hello there.
I just have a little problem I can't wrap my head around.
The function "intersects" returns true even if the rects should not have space in common.

#include "stdafx.h"
#include "SFML\Graphics.hpp"


int _tmain(int argc, _TCHAR* argv[])
{

        sf::Rect<float> rect1 (4.0f, 3.0f, 4.5f, 3.5f);        // Hint: Nexus = sf::Rect<float> (4.0f, 3.0f, 4.5f, 3.5f);
        sf::Rect<float> rect2 (4.0f, 3.5f, 4.5f, 4.0f);        // Hint: Nexus = sf::Rect<float> (4.0f, 3.5f, 4.5f, 4.0f);

        sf::Rect<float> rect3 (6.0f, 7.0f, 7.0f, 8.0f);        // Hint: Nexus  = sf::Rect<float> (6.0f, 7.0f, 7.0f, 8.0f);
       
        if (rect1.intersects (rect3)) std::cout << "Rect 1 intersects Rect 3" << std::endl;
        if (rect2.intersects (rect3)) std::cout << "Rect 2 intersects Rect 3" << std::endl;

        system("PAUSE");

        return 0;
}

On my console the program returns: Rect 2 intersects Rect 3.

From what I understand it should look like that:
(Rect 1 isn't shown)


So, where am I wrong, or why do they intersect?

Thanks in advance.

Pages: [1]