Solo game

- add event for resize
This commit is contained in:
Kum1ta
2024-11-15 16:37:25 +01:00
parent c7d1cf4c18
commit 620bfed825
2 changed files with 11 additions and 3 deletions

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* multiLocalGamePage.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 12:07:39 by edbernar #+# #+# */
/* Updated: 2024/11/11 15:42:23 by hubourge ### ########.fr */
/* Updated: 2024/11/15 16:36:53 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -40,6 +40,7 @@ class multiLocalGamePage
renderer.domElement.style.filter = 'brightness(1)';
document.getElementById('score').style.animation = 'fadeOutStartGames 1s';
window.addEventListener('resize', windowUpdater);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
Ball.create(scene);
@ -122,4 +123,11 @@ function gameFinish()
}, 3000);
}
function windowUpdater()
{
renderer.setSize(window.innerWidth, window.innerHeight);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
};
export { multiLocalGamePage };