SFML community forums

Help => Graphics => Topic started by: Ptlomej on February 21, 2012, 03:38:57 pm

Title: sf::Shape Pointer ?
Post by: Ptlomej on February 21, 2012, 03:38:57 pm
Using SFML 1.6
Visual C++

Code: [Select]

sf::Shape S1 = sf::Shape::Circle(sf::Vector2f(X,Y),sf::Randomizer::Random(2,20),sf::Color::White);
sf::Shape *S2 = new [u]sf::Shape::Circle[/u](sf::Vector2f(X,Y),sf::Randomizer::Random(2,20),sf::Color::White);


The underline is the Error ?
Title: sf::Shape Pointer ?
Post by: Laurent on February 21, 2012, 03:45:08 pm
sf::Shape::Circle is not a type, it's a function. The result is always a sf::Shape.

Code: [Select]
sf::Shape *S2 = new sf::Shape;
*S2 = sf::Shape::Circle(sf::Vector2f(X,Y),sf::Randomizer::Random(2,20),sf::Color::White);
Title: sf::Shape Pointer ?
Post by: Ptlomej on February 21, 2012, 04:00:36 pm
Thank you i doesnt know that but now works fine ;)