Skip to content

Commit

Permalink
Merge pull request #316 from zstenger93/tournoment
Browse files Browse the repository at this point in the history
Tournoment
  • Loading branch information
zstenger93 authored Apr 16, 2024
2 parents f5f7a3b + 4321394 commit a895b83
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,11 @@ backend/authentication/images/*
# media
media
node_modules

#ssl_keys
*.crt
*.key
*.pem


docker/data
3 changes: 2 additions & 1 deletion backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ALLOWED_HOSTS = [
'*',
'localhost',
'10.12.2.2',
'172.19.0.4',
'127.0.0.1',
'0.0.0.0',
Expand Down Expand Up @@ -90,7 +91,7 @@
]

CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True
# CORS_ORIGIN_ALLOW_ALL = True
SESSION_COOKIE_SAMESITE = None
SESSION_COOKIE_SECURE = True
# SESSION_COOKIE_SAMESITE = 'Lax'
Expand Down
2 changes: 1 addition & 1 deletion docker/backend/backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ python manage.py makemigrations && python manage.py migrate
# tail -f /var/log/daphne/daphne.log


# daphne -b 0.0.0.0 backend.asgi:application
daphne -b 0.0.0.0 backend.asgi:application
# hang the container
tail -f /dev/null
21 changes: 8 additions & 13 deletions frontend/src/pages/Games/Pong3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,13 @@ function Pong3D() {
});
const textGeometry = new THREE.PlaneGeometry(15, 15);
const textMesh = new THREE.Mesh(textGeometry, textMaterial);
textMesh.position.set(
0,
-shortGeometry / 2 - wallThickness * 3,
wallThickness / 2 + 0.1
);
scene.add(textMesh);
textMesh.position.set(2, -6, 13);
// scene.add(textMesh);
const boucneCanvas = document.createElement("canvas");
const bounceContext = boucneCanvas.getContext("2d");
bounceContext.font = "20px nosifer";
bounceContext.fillStyle = "white";
bounceContext.fillText("BOUNCE COUNT: 0", 6, 24);
// bounceContext.fillText("BOUNCE COUNT: 0", 6, 24);
const bounceMaterialTexture = new THREE.CanvasTexture(boucneCanvas);
const bounceMaterial = new THREE.MeshBasicMaterial({
map: bounceMaterialTexture,
Expand All @@ -170,17 +166,15 @@ function Pong3D() {
const sunMaterialLayer2 = new THREE.MeshBasicMaterial({
color: 0xffff00,
map: sunTexture,
rougness: 0.1,
metalness: 1,
opacity: 0.1,
transparent: true,
});

const sunMaterial = new THREE.MeshBasicMaterial({
color: 0xff8800,
map: sunTexture,
rougness: 0.1,
metalness: 1,
// rougness: 0.1,
// metalness: 1,
});
const sunGeometry = new THREE.SphereGeometry(10, 32, 32);
const sunGeometryLayer2 = new THREE.SphereGeometry(12, 32, 32);
Expand All @@ -189,6 +183,7 @@ function Pong3D() {
const sunLayer2 = new THREE.Mesh(sunGeometryLayer2, sunMaterialLayer2);
scene.add(sun);
sun.add(sunLayer2);
sun.add(textMesh);

const stars = [];
for (let i = 0; i < 1000; i++) {
Expand Down Expand Up @@ -414,8 +409,8 @@ function Pong3D() {
boucneCanvas.width,
boucneCanvas.height
);
bounceContext.fillText("BOUNCE COUNT: " + bounceCounter, 6, 24);
bounceMaterialTexture.needsUpdate = true;
// bounceContext.fillText("BOUNCE COUNT: " + bounceCounter, 6, 24);
// bounceMaterialTexture.needsUpdate = true;
// eslint-disable-next-line react-hooks/exhaustive-deps
isCodeExecuted = true;
} else {
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/pages/Games/Tournament.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ class TournamentData {
this.createRoundRobin();
break;
case 1:
this.createSingleElimination();
this.createRoundRobin();
break;
case 2:
this.createSwiss();
this.createRoundRobin();
break;
default:
this.createRoundRobin();
Expand Down Expand Up @@ -938,7 +938,7 @@ const Tournament = () => {
</div>
);
}

const interval = useRef(null);
useEffect(() => {
if (pageToRender === 3) {
const canvas = canvasRef.current;
Expand All @@ -957,7 +957,7 @@ const Tournament = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
scorePlayer2 = 0;
ctxRef.current = ctx;
const interval = setInterval(() => update(canvas, ctx), 1000 / 30);
interval.current = setInterval(() => update(canvas, ctx), 1000 / 30);
return () => clearInterval(interval);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -1031,6 +1031,7 @@ const Tournament = () => {
if (scorePlayer1 >= 2 || scorePlayer2 >= 2) {
ballSpeed = 0;
updateResults();
clearInterval(interval.current);
if (tournament.matches.length !== 0) setPageToRender(2);
else setPageToRender(4);
}
Expand Down

0 comments on commit a895b83

Please sign in to comment.