SFML community forums

Help => Graphics => Topic started by: GNRlova23 on March 07, 2013, 12:00:24 am

Title: Can I create an array list for shapes?
Post by: GNRlova23 on March 07, 2013, 12:00:24 am
I'm still new to C++ and SFML, and I'm trying my best to experiment as much as possible. So yeah, my question is: Is there a way I can create an array (Or array list, I'm not sure of the difference) of shapes?
Title: Re: Can I create an array list for shapes?
Post by: eXpl0it3r on March 07, 2013, 12:06:44 am
Of course there is! ;D
But this isn't strictly connected to SFML, since you can have an array (or better a std::vector) of any type in C++. Since you apparently don't know how to work with them, I strongly advise you to get a good C++ book (http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) and read it! ;)
SFML is a nice and Simple library, with a clean API and thus it can mislead beginners into thinking that it's a good starting point to learn C++, but in fact SFML does require a good amount of rock solid C++ knowledge, otherwise you'll get stuck at every other corner.
Also if you wanted to start with a game, you should know that programming games can be one of the harder tasks in programming, since it pulls in all kinds of areas (graphics, algorithms, datastructures, audio, code design, networking, etc. etc.). You should really start of slow and learn the basics of C++ in good fashion before moving on. ;)

sf::Shape shapes[20];
// or better use a std::vector
std::vector<sf::Shape> shapes(20);
Title: Re: Can I create an array list for shapes?
Post by: GNRlova23 on March 07, 2013, 12:17:46 am
I think you're absolutely right. Thanks for directing me to the right website too. I've actually just started programming just out of pure interest, using free online tutorials. But I definately will check out these books. Thanks once again  :D