import * as THREE from 'three';
import { App, makeEnvironment, makeLights } from './core/app';
import { Game } from './game/game';
import './style.css';

const canvas = document.getElementById('c') as HTMLCanvasElement;
const app = new App(canvas);
makeLights(app.scene);
makeEnvironment(app);
app.scene.background = new THREE.Color(0x241a15);

const game = new Game(app);
// Rapier's wasm has to be up before the drawer can be opened, but the toaster
// works without it — so boot the game now and let physics catch up.
void game.init();

if (import.meta.env.DEV) {
  void import('./dev').then((m) => m.installDevHarness(app, game));
}

app.start();
