1
General / Drawing different views with the same tileset.
« on: May 26, 2023, 02:50:24 pm »
Hello,
I have a class with essentially the following drawable function:
I want to be able to change the "m_vertices" between two different views where the tiles shown in one view remain unchanged after each draw but the other the tile placements can change. As far as I can tell, I can't change the draw function to have an option to select different "m_vertices" at draw time. I think that I could run set two instances of the class for each view but then I would have to load the tileset twice when initializing or set a separate function that sets a flag that changes the "m_vertices" before the tiles are drawn. Are these the only options or is there another way to adjust the drawable for the class?
I have a class with essentially the following drawable function:
Code: [Select]
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const{
states.transform*=getTransform();
states.texture=&m_tileset;
target.draw(m_vertices, states);
}
I want to be able to change the "m_vertices" between two different views where the tiles shown in one view remain unchanged after each draw but the other the tile placements can change. As far as I can tell, I can't change the draw function to have an option to select different "m_vertices" at draw time. I think that I could run set two instances of the class for each view but then I would have to load the tileset twice when initializing or set a separate function that sets a flag that changes the "m_vertices" before the tiles are drawn. Are these the only options or is there another way to adjust the drawable for the class?