options->get('graphics', 'retro') === 'hd' && $engine->gl()->isAvailable() ? 'hd' : 'retro'; } public static function toggle(Engine $engine): void { if (!$engine->gl()->isAvailable()) { return; } $engine->options->set('graphics', self::mode($engine) === 'hd' ? 'retro' : 'hd'); } /** The HD renderer, enabled, when the HD mode is on; null otherwise (and the HD layer off). */ public static function hd(Engine $engine): ?HdRenderer { if (self::mode($engine) !== 'hd') { self::retro($engine); return null; } $hd = HdRenderer::get($engine->gl(), Art::get($engine->config->path('assets/data/art.pak'))); $hd->enable(); return $hd; } /** Back to the plain 2D output (the retro renderer draws its own picture). */ public static function retro(Engine $engine): void { if ($engine->gl()->isAvailable()) { HdRenderer::get($engine->gl(), Art::get($engine->config->path('assets/data/art.pak')))->disable(); } } }