This is the perfect approach for me. I need the
window.draw
to accept both the render states and the primitive type.
The main problem for me is that i yet don't know how i can implement SFML's abilities with transforming my vertex array. I tried to make a small demo program, but i don't know if it's correct.
class CObject{
std::vector<sf::Vertex> m_vertices;
sf::RenderStates m_renderStates;
};
class CFramework{
void draw(CObject object){
window.draw(&object.m_vertices[0], object.m_vertices.get_size(), sf::Trianglefan, object.m_renderStates);
}
};
main(){
CObject object;
object.m_vertices.push_back(sf::Vertex(sf::Vector2f(10.f, 10.f), sf::Color::Red));
CFramework framework;
framework.draw(object);
//this demo is missing many parts and should only be used to demonstrate a posssible solution
}
If i am correct, depending on what i pass the render state, the object gets rotated, upscaled, downscaled, moved. But does that effect the vector's instances of sf::Vertex?