Greetings,
I have a list of objects that have a property zIndex, which indicates the order the objects are processed (updated/draw).
Whats the best way to process them in the correct order? Sort the vector each time I push a new object? Use another kind of container?
Think about operative system windows. Usual they are showed in the order they are opened (with some exceptions ofc). But when you click on one in the back, it activates and passes to the front. Does it remove from the list and pushes again so its the last to be drawn?
Think in a top-down game. You have the ground tiles, then ground objects, then flying objects. Do you have separated lists for each layer?
It probably depends on the use, but whats the usual approach to this?
Thanks,
chaos