Skip to content

Commit

Permalink
Create main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
davespser authored Dec 5, 2024
1 parent 1add75a commit 3fc3ea2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { initLobby } from './lobby.js';
import { initCuestionario } from './cuestionario.js';
import { initEscenario1 } from './escenario1.js';

// Configuración inicial
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);

// Controlador de escenas
let currentScene, currentAnimationLoop;

// Función para cambiar escenas
function switchScene(newScene, newAnimationLoop) {
if (currentAnimationLoop) cancelAnimationFrame(currentAnimationLoop);
currentScene = newScene;
currentAnimationLoop = newAnimationLoop;
newAnimationLoop();
}

// Inicializar el Lobby como escena inicial
initLobby(renderer, camera, switchScene);

0 comments on commit 3fc3ea2

Please sign in to comment.