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

Author Topic: sf::RectangleShape bounds + outline thickness problem  (Read 1172 times)

0 Members and 1 Guest are viewing this topic.

heyufool1

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
sf::RectangleShape bounds + outline thickness problem
« on: January 12, 2013, 06:27:33 am »
Hello!  This is my first post here! :)  I am experiencing a problem retrieving the local (or global) bounds for a  sf::RectangleShape.  I create a rectangle with a height of 19 and an outline thickness of 2.  The local bounds then displays a height of 23 correctly.  However, if I use the setSize function and give it the same height of 19 then the local bounds displays a height of 19, disregarding the outline thickness of 2.  However, the outline thickness is still set to 2.  The function appears to be ignoring the outline thickness in the bounds calculation. 

mItemButton.setOutlineThickness(2);
mItemButton.setSize(sf::Vector2f(100, 19));
mItemButton.setOrigin(-mItemButton.getOutlineThickness(), -mItemButton.getOutlineThickness());

// Inside bounds height = 19 (Correct)
// Bounds height = 23 (Correct)

mItemButton.setSize(sf::Vector2f(0, 19));

// Inside bounds height = 19 (Correct)
// Bounds height = 19 (Incorrect)

Any ideas of what the problem could be?

UPDATE:  Well, I found that changing the shape's width to 0 causes the problem.  I'm not sure if that's a bug or intentional  :-\
« Last Edit: January 12, 2013, 06:38:59 am by heyufool1 »

 

anything