SFML community forums
Help => Graphics => Topic started by: killer13666 on October 30, 2014, 03:49:41 pm
-
I am new to sfml, and I want to know if it is possible to make an array of sprites?
-
You can make an array of anything. SFML doesn't change how the C++ language works.
Whether you should make an array of sprites is an entirely different question (std::vector is usually better), but that depends on the program you're writing.
If you have to ask a question like this, it's probably worth reading a good book on C++ itself before trying to use C++ libraries.
-
Would std::vector be a more efficient choice over an array, or does it matter?
-
It depends on what you want to do with it. If you read a proper C++ book and understand what arrays and vectors actually are, then the decision is very easy to make. They're both as efficient as they can possibly be if you use them for what they're meant to be used for (like almost everything else in C++).
-
If you worry about the performance of plain C/C++ arrays[] vs std::array vs std::vector then you are doing it wrong.
By default, just use std::vector. In the rare case you need something else; you'll know (I hope).
Just use vector...