Updated the draw function to only update when the screen has actually changed. This does require assigning refreshNeeded when the board state has changed or screenClearNeeded when you need to both refresh and clear the entire screen. I have updated every case that needs it.
In general I am trying to avoid full screen clears when possible and now it only happens when the intro timers are running, a new piece is placed, or an effect is playing. I think with more optimizations it can probably be minimized even further for effects, but that'll require a bit more work.
I'm also precomputing the grid display on initialization into its own images (one for big blocks and one for regular) instead of recalculating them on every draw call. This greatly reduces the cost to draw the grid.
This was all tested on an actual Playdate device and the performance difference between this and 1.5.1 is definitely noticable.
Updated the draw function to only update when the screen has actually changed. This does require assigning
refreshNeeded
when the board state has changed orscreenClearNeeded
when you need to both refresh and clear the entire screen. I have updated every case that needs it.In general I am trying to avoid full screen clears when possible and now it only happens when the intro timers are running, a new piece is placed, or an effect is playing. I think with more optimizations it can probably be minimized even further for effects, but that'll require a bit more work.
I'm also precomputing the grid display on initialization into its own images (one for big blocks and one for regular) instead of recalculating them on every draw call. This greatly reduces the cost to draw the grid.
This was all tested on an actual Playdate device and the performance difference between this and 1.5.1 is definitely noticable.