1
Graphics / Re: Trying to draw vector of vertices.
« on: March 24, 2018, 08:41:13 pm »
Okay, that makes sense. Thank you for the response.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
...you shouldn't derive from sf::Vertex...
You can draw a vector of vertices simply by calling window.draw(vec.data(), vec.size());.
You can't draw a std::list like that because the list doesn't hold the data in a continuous memory block. Instead you'll have to iterate over it and draw each part on its own.
Keep in mind though that draw calls are somewhat expensive and if you can create a vertex array/vector of vertices, you can gain some performance.
Iterating over a list/vector, and the basics of STL containers in general, have nothing to do with SFML so please pick some tutorial and learn that first instead of trying to guess
Then I'm not sure I understand your other questions about sf::VertexArray. But the source code is dead simple to understand, and there are also the tutorials and documentation that explain it pretty well, so make sure to have a look at all this stuff first.
Not that I completely understand what you want, but for a fireworks simulation I would say take a look at the particle system example in the tutorial "Designing your own entities with vertex arrays".