Skip to content

Commit

Permalink
gc2Merge branch 'main' of github.com:hu8813/pong42
Browse files Browse the repository at this point in the history
  • Loading branch information
hu8813 committed Apr 23, 2024
2 parents 70be7cb + a014f4c commit 038dfc9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
17 changes: 0 additions & 17 deletions srcs/frontend/css/tournament.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,3 @@
height: auto;
box-shadow: 0 0 15px rgba(0,0,0,0.5);
}



#TButton {
position: absolute;
top: 58%;
left: 50%;
transform: translate(-50%, -50%);
padding: 10px 20px;
font-size: 18px;
color: #FFF;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
display: none;
}
7 changes: 6 additions & 1 deletion srcs/frontend/js/tournament.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
function askPlayerCount() {
const canvas = document.getElementById('canvastour');
if (!canvas) return;

const ctx = canvas.getContext('2d');
canvas.width = 800;
canvas.height = 600;
ctx.clearRect(0, 0, canvas.width, canvas.height);

ctx.fillStyle = "rgba(0, 0, 0, 0.75)";
Expand All @@ -27,7 +30,7 @@ function askPlayerCount() {
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;

if (x < canvas.width / 3) {
if (x < canvas.width / 3.4) {
startTournament(4);
} else {
startTournament(8);
Expand All @@ -36,7 +39,9 @@ function askPlayerCount() {
});
}


function startTournament(playerCount) {
console.log(`Turnier mit ${playerCount} Spielern wird gestartet.`); // Zum Debuggen hinzugefügt
const players = [];
for (let i = 1; i <= playerCount; i++) {
players.push(i);
Expand Down
4 changes: 1 addition & 3 deletions srcs/frontend/views/tournament.html
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<canvas id="canvastour" width="800" height="600"></canvas>
<button id="TButton" style="display:none;">Play Again!</button>
<button id="nextMatchButton" style="visibility: hidden;">Nächstes Match starten</button>
<canvas id="canvastour" width="800" height="600"></canvas>

0 comments on commit 038dfc9

Please sign in to comment.