diff --git a/docker-compose/requirements/djangoserver/file/server/server/Game.py b/docker-compose/requirements/djangoserver/file/server/server/Game.py index 372a696..760b21f 100644 --- a/docker-compose/requirements/djangoserver/file/server/server/Game.py +++ b/docker-compose/requirements/djangoserver/file/server/server/Game.py @@ -6,7 +6,7 @@ # By: edbernar +

0 fps

0 ms

+
+

You lose...

+

0 - 0

+

You will be redirected to the lobby in 5 seconds

+
@@ -13,4 +19,6 @@
+ + diff --git a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js index 2d0d914..7562711 100644 --- a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js +++ b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js @@ -6,7 +6,7 @@ /* By: edbernar usernameP.innerHTML = userMeInfo.username); else @@ -145,7 +146,6 @@ function startMode() function startMultiLocal() { document.body.style.animation = "none"; - document.body.offsetHeight; document.body.style.animation = "startGameAnim 0.5s"; document.body.style.opacity = 0; setTimeout(() => { @@ -156,7 +156,6 @@ function startMultiLocal() function startMatchmaking() { document.body.style.animation = "none"; - document.body.offsetHeight; document.body.style.animation = "startGameAnim 0.5s"; document.body.style.opacity = 0; setTimeout(() => { diff --git a/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Map.js b/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Map.js index f6ec418..af69079 100644 --- a/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Map.js +++ b/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Map.js @@ -6,7 +6,7 @@ /* By: edbernar { videoTmp.play(); drawVideoOnCanvas(); diff --git a/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Player.js b/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Player.js index 86074f5..5ca348a 100644 --- a/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Player.js +++ b/docker-compose/requirements/nginx/static/javascript/multiOnlineGame/Player.js @@ -6,7 +6,7 @@ /* By: edbernar { + simpleText.innerText = `You will be redirected to the lobby in ${time} seconds` + time--; + if (time == -1) + { + clearInterval(intervalEnd); + setTimeout(() => pageRenderer.changePage('lobbyPage'), 500); + } + }, 1000); + } } function createBarPlayer(skin) @@ -240,7 +261,6 @@ function createBarPlayer(skin) const geometry = new THREE.BoxGeometry(1, 0.1, 0.1); let material = null; - console.log(skin) if (skin.color) material = new THREE.MeshPhysicalMaterial({color: skin.color}); else @@ -251,14 +271,8 @@ function createBarPlayer(skin) return (mesh); } -function changeBarColor(bar, color) +function windowUpdater() { - bar.material.color.set(color); -} - -function windowUpdater(e) -{ - console.log('udapte'); renderer.setSize(window.innerWidth, window.innerHeight); player.camera.aspect = window.innerWidth / window.innerHeight; player.camera.updateProjectionMatrix(); @@ -266,10 +280,7 @@ function windowUpdater(e) function loop() { - ///////////// - stats.begin(); - ///////////// - + showFps(); player.update(); opponent.update(); ball.update(); @@ -281,10 +292,24 @@ function loop() } else renderer.render(scene, player.camera); +} - ///////////// - stats.end(); - //////////// +let lastFpsArr = [10, 3, 5]; + +function showFps() +{ + const fps = document.getElementById('fps') + const now = Date.now(); + + if (now > lastFpsDisplayed + 800) + { + fps.innerText = Math.round(lastFpsArr.reduce((a, b) => a + b, 0) / lastFpsArr.length) + ' fps'; + lastFpsDisplayed = now; + lastFpsArr = []; + } + else + lastFpsArr.push(Math.floor(1000 / (now - lastFpsTime))); + lastFpsTime = now; } export { MultiOnlineGamePage, player, opponent, ball, map}; \ No newline at end of file diff --git a/docker-compose/requirements/nginx/static/javascript/typeResponse/typeGame.js b/docker-compose/requirements/nginx/static/javascript/typeResponse/typeGame.js index a20e6e9..2c44b2e 100644 --- a/docker-compose/requirements/nginx/static/javascript/typeResponse/typeGame.js +++ b/docker-compose/requirements/nginx/static/javascript/typeResponse/typeGame.js @@ -6,7 +6,7 @@ /* By: edbernar