dune2themaker4j icon indicating copy to clipboard operation
dune2themaker4j copied to clipboard

Draw units and selection boxes separately (take layers/z index into account)

Open stefanhendriks opened this issue 9 years ago • 4 comments

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.

stefanhendriks avatar Mar 18 '15 14:03 stefanhendriks

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.

NinovanderMark avatar Mar 18 '15 14:03 NinovanderMark

yes, this is easy to do.

stefanhendriks avatar Mar 18 '15 14:03 stefanhendriks

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.

stefanhendriks avatar Oct 19 '15 07:10 stefanhendriks

removing this from alpha 3 since this has nothing to do with base building and I'm trying to keep it focussed.

stefanhendriks avatar Sep 19 '16 20:09 stefanhendriks