There is a segment of my game where the camera follows a sprite as it moves over a larger map (achieved via the offset draw function). I also use sprite objects to track entities in the game, and in the hope for performance, I created a collision box that follows the camera as it moves which informs sprites colliding with it to become visible, and those not, to be invisible. This got me wondering if the playdate already performs this kind of optimization. Setting sprite's visibility is described as enabling or disabling their draw() function, but I was wondering if anyone knows whether the draw function is already skipped, or runs negligible code, when it's sprite is off-screen.
If the sprite's bounds don't intersect any part of the screen that's marked as needing an update, its draw callback won't be called. If it has an
update() callback, that will continue to be called while it's off-screen.