<?phpnamespace App\Scene;/** The pause menu, over the frozen level. */final class PauseScene extends MenuBase{ protected string $title = 'PAUSE'; private int $level = 0; public function __construct(\App\Service\Art $art, \App\Service\Fonts $fonts, \App\Service\Audio $audio, private \App\Service\Progress $progress) { parent::__construct($art, $fonts, $audio); } public function isOverlay(): bool { return true; } public function enter(array $params = []): void { $this->level = (int)($params['level'] ?? $this->progress->current); parent::enter($params); } protected function items(): array { return [ ['RESUME', null, fn () => $this->scenes()->pop()], ['RESTART', null, fn () => $this->scenes()->switchTo(PlayScene::class, ['level' => $this->level])], ['OPTIONS', null, fn () => $this->scenes()->push(OptionsScene::class)], ['LEVELS', null, fn () => $this->scenes()->switchTo(LevelScene::class, ['level' => $this->level])], ]; } protected function back(): void { $this->scenes()->pop(); } public function update(float $dt): void { if ($this->actions()->isPressed('pause') && !$this->actions()->isPressed('back')) { $this->scenes()->pop(); return; } parent::update($dt); }}