KO
games/runtime-demo / src / Scene / TitleScene.php · commit 459a354
<?phpnamespace App\Scene;use JumPHP\Kernel\Platform;use JumPHP\Native\Shell;use JumPHP\Ui\MenuScene;/** The main menu of the example game of the Runtime extension. */final class TitleScene extends MenuScene{    protected string $title = 'RUNTIME DEMO';    protected function items(): array    {        $items = [            ['PLAY', null, fn () => $this->scenes()->switchTo(DemoScene::class)],            ['TUTORIAL', null, fn () => $this->open('https://jumphp.net/extensions/jumphp/runtime/tutoriel')],            ['DOCUMENTATION', null, fn () => $this->open('https://jumphp.net/extensions/jumphp/runtime/documentation')],        ];        if (Platform::isDesktop()) {            $items[] = ['QUIT', null, fn () => $this->engine->quit()];        }        return $items;    }    private function open(string $url): void    {        if (Platform::isWasm()) {            $this->engine->bridge->send('open', ['url' => $url]);        } else {            Shell::openUrl($url);        }    }    protected function back(): void    {    }}