demo?->release(); $this->demo = new DemoRunner($this->engine, $this->art, (int)($params['demoLevel'] ?? 2)); if ($this->sound()->getCurrentMusic() !== 'title') { $this->sound()->playMusic('title'); } } public function exit(): void { $this->demo?->release(); $this->demo = null; } protected function items(): array { $items = [ ['PLAY', null, fn () => $this->scenes()->switchTo(LevelScene::class)], ['OPTIONS', null, fn () => $this->scenes()->push(OptionsScene::class)], ]; if (Platform::isDesktop()) { $items[] = ['QUIT', null, fn () => $this->engine->quit()]; } return $items; } protected function top(): float { return 150; } public function update(float $dt): void { $this->demo?->update($dt); parent::update($dt); } protected function renderBackground(Renderer $r): void { $this->demo?->render($r); $r->fillRect(0, 232, 480, 38, [12, 8, 24]); $r->fillRect(0, 0, 480, 270, [8, 4, 20, 85]); [$logoW] = $this->art->size('logo'); $bob = sin($this->time * 1.6) * 3; $this->art->draw($r, 'logo', null, 240 - $logoW / 2, 8 + $bob); $this->fonts->text($this->engine, $r, 'TAGLINE', 240, 118, 1.15, [255, 240, 200], 'center'); $this->fonts->text($this->engine, $r, 'CREDITS', 240, 252, 0.85, [170, 160, 210], 'center'); } }