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

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */ /* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */ /* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
/* Updated: 2024/11/13 15:22:43 by edbernar ### ########.fr */ /* Updated: 2024/11/15 16:35:17 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */