()
| 85 | /// Sorts the sprites by z-order if the contents changed. Called by the renderer |
| 86 | /// before drawing. |
| 87 | void ensureSorted() { |
| 88 | if (sortDirty) { |
| 89 | Collections.sort(sprites, Z_ORDER); |
| 90 | sortDirty = false; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /// Forces a re-sort on the next frame. Call this after changing a sprite's |
| 95 | /// z-order so the new ordering takes effect. |