feat: Implement scrolling camera with layout-aware filtering

- Rename VERTICAL camera mode to FEED (rapid single-item view)
- Add SCROLL camera mode with float accumulation for smooth movie-credits style scrolling
- Add estimate_block_height() for cheap layout calculation without full rendering
- Replace ViewportFilterStage with layout-aware filtering that tracks camera position
- Add render caching to FontStage to avoid re-rendering items
- Fix CameraStage to use global canvas height for scrolling bounds
- Add horizontal padding in Camera.apply() to prevent ghosting
- Add get_dimensions() to MultiDisplay for proper viewport sizing
- Fix PygameDisplay to auto-detect viewport from window size
- Update presets to use scroll camera with appropriate speeds
This commit is contained in:
2026-03-17 00:21:18 -07:00
parent 4c97cfe6aa
commit 57de835ae0
12 changed files with 303 additions and 66 deletions

View File

@@ -1,19 +1,18 @@
from engine.camera import Camera, CameraMode
def test_camera_vertical_default():
"""Test default vertical camera."""
cam = Camera()
assert cam.mode == CameraMode.VERTICAL
assert cam.mode == CameraMode.FEED
assert cam.x == 0
assert cam.y == 0
def test_camera_vertical_factory():
"""Test vertical factory method."""
cam = Camera.vertical(speed=2.0)
assert cam.mode == CameraMode.VERTICAL
cam = Camera.feed(speed=2.0)
assert cam.mode == CameraMode.FEED
assert cam.speed == 2.0