dune2themaker4j
dune2themaker4j copied to clipboard
Draw units and selection boxes separately (take layers/z index into account)
From comment on #62
I'm noticing a z-index issue with the unit selection box: when a unit is selected and it drives diagonally past another unit, then the selection box is draw underneath the other unit. This seems logical: we draw the unit and the selection box in one pass, but they should probably be separate. Either we need to draw selection boxes after all units are rendered, or we need to change the draw order of units so it draws selected units last. I prefer the 1st option.
Wouldn't it make sense to make selection boxes and the like part of a separate drawing pass for UI elements? That way we can insure that things like health bars and other stuff are drawn on top of the game view as well.
yes, this is easy to do.
We now have a RenderQueue
that does solve stuff with drawing in a specific order. Ie, it draws selection boxes last, as well as health bars.
The one thing that does not work yet is drawing units on the same 'layer' in the correct order. Ie, I would expect a Harvester to be drawn 'over' a tank a bit when the Tank is position above the Harvester in an adjacent cell.
removing this from alpha 3 since this has nothing to do with base building and I'm trying to keep it focussed.