SFML community forums

Help => Graphics => Topic started by: Elo01 on August 10, 2009, 07:41:21 pm

Title: Shape.Rectangle() not working?
Post by: Elo01 on August 10, 2009, 07:41:21 pm
Alright, I guess I'm just using the function the wrong way - Anyway, here's the problem (using SFML 1.5 if that matters):

Code: [Select]
sf::Shape test1 = sf::Shape::Rectangle(200, 200, 400, 400, sf::Color(222, 222, 222));
The above code works just fine and draws a rect as expected, however
Code: [Select]
sf::Shape test2;
test2.Rectangle(200, 200, 400, 400, sf::Color(222, 222, 222));

doesn't seem to work (not drawing anything when calling RenderWindow.Draw()).
The weird thing is, GetPosition() still returns the right coordinates for the 2nd code.


Am i doing something wrong?

Edit: Just realised its a static function and won't work that way, nevermind this thread :/
Title: Shape.Rectangle() not working?
Post by: Laurent on August 10, 2009, 08:02:05 pm
sf::Shape::Rectangle is a static function that returns a new sf::Shape instance. So your second way of using it is totally wrong ;)