RetroRampage icon indicating copy to clipboard operation
RetroRampage copied to clipboard

Core Animation renderer

Open nicklockwood opened this issue 5 years ago • 0 comments

This PR demonstrates how to implement GPU-accelerated rendering using Core Animation. This allows the game to be rendered at full display resolution, and with much better performance.

The renderer uses a CALayer pool as a simple optimization to avoid churning the view hierarchy each frame. There are opportunities for further optimizations however, for example:

  • The map never changes, so the layers for walls and floor could just be generated once.
  • Currently, layers are generated for every wall and floor/ceiling tile in the map, but we could use raycasting to determine the visible set of tiles and only render those.

I haven't bothered to implement fizzlefade currently. It's not clear what the most efficient way to draw a fizzle effect would be in Core Animation, but if all else fails you could just use Core Graphics.

I also haven't implemented font color tinting, since there's no simple way to implement this with UIImages either (at least, not in real-time).

nicklockwood avatar Jul 17 '19 22:07 nicklockwood