diff --git a/index.html b/index.html index 4648ed2..ea7f4d5 100644 --- a/index.html +++ b/index.html @@ -80,32 +80,34 @@
Swipe down: Soft drop
Tap anywhere: Rotate right
Double-tap: Hard drop
-Triple-tap: 3D rotate
+3D Flip Buttons: Rotate in 3D
`; document.body.appendChild(touchInstructions); @@ -2408,6 +2481,31 @@ function createTouchControlButtons() { if (scoreContainer) { scoreContainer.appendChild(instructionsBtn); } + + // Add performance mode toggle + const perfToggle = document.createElement('input'); + perfToggle.type = 'checkbox'; + perfToggle.id = 'toggle-mobile-performance'; + perfToggle.checked = mobilePerformanceMode; + + const perfLabel = document.createElement('label'); + perfLabel.htmlFor = 'toggle-mobile-performance'; + perfLabel.textContent = 'Perf Mode'; + perfLabel.className = 'perf-label'; + + const perfContainer = document.createElement('div'); + perfContainer.className = 'perf-toggle'; + perfContainer.appendChild(perfToggle); + perfContainer.appendChild(perfLabel); + + if (scoreContainer) { + scoreContainer.appendChild(perfContainer); + } + + // Add event listener + perfToggle.addEventListener('change', function() { + mobilePerformanceMode = this.checked; + }); } // Set active piece to next piece and create new next piece @@ -2496,10 +2594,23 @@ function getNextPieceFromBag() { const tetromino = PIECES[pieceIndex]; const color = COLORS[pieceIndex]; + // Get the tetromino type based on index + let tetrominoType; + switch(pieceIndex) { + case 0: tetrominoType = 'I'; break; + case 1: tetrominoType = 'J'; break; + case 2: tetrominoType = 'L'; break; + case 3: tetrominoType = 'O'; break; + case 4: tetrominoType = 'S'; break; + case 5: tetrominoType = 'T'; break; + case 6: tetrominoType = 'Z'; break; + default: tetrominoType = 'X'; + } + // Random rotation/orientation const randomIndex = Math.floor(Math.random() * tetromino.length); - return new Piece(tetromino, randomIndex, color); + return new Piece(tetromino, randomIndex, color, tetrominoType); } // Start the game diff --git a/style.css b/style.css index d6c8c1b..e52a7de 100644 --- a/style.css +++ b/style.css @@ -249,7 +249,7 @@ canvas { left: 0; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, 0.7); + background: rgba(0, 0, 0, 0.8); z-index: 100; justify-content: center; align-items: center; @@ -260,25 +260,23 @@ canvas { } .modal-content { - background: rgba(0, 0, 0, 0.9); - padding: 30px; + background: rgba(10, 10, 20, 0.85); + border: 2px solid rgba(0, 255, 255, 0.6); border-radius: 10px; + color: white; + padding: 20px; + width: 90%; + max-width: 500px; + box-shadow: 0 0 30px rgba(0, 255, 255, 0.5); text-align: center; - border: 2px solid #444; - box-shadow: 0 0 20px rgba(0, 255, 255, 0.5); - animation: modal-appear 0.5s; } -@keyframes modal-appear { - from {transform: scale(0.8); opacity: 0;} - to {transform: scale(1); opacity: 1;} -} - -.modal-content h2 { - font-size: 24px; - margin-bottom: 20px; - color: #ff0066; - text-shadow: 0 0 10px #ff0066; +.modal h2 { + margin-top: 0; + color: #00ffff; + text-shadow: 0 0 10px rgba(0, 255, 255, 0.7); + text-transform: uppercase; + letter-spacing: 2px; } .modal-content p { @@ -387,17 +385,32 @@ canvas#tetris { /* Options menu styles */ .option-row { display: flex; - justify-content: space-between; align-items: center; - margin: 20px 0; - padding: 10px; - background: rgba(51, 51, 51, 0.8); - border-radius: 5px; + margin: 15px 0; + position: relative; } .option-row label { - font-size: 14px; - color: #fff; + margin-right: 10px; + min-width: 180px; +} + +.tooltip { + font-size: 12px; + color: #aaa; + font-style: italic; + margin-left: 10px; + max-width: 200px; +} + +.mobile-only { + display: none; +} + +@media (max-width: 768px) { + .mobile-only { + display: flex; + } } /* Toggle switch styles */ @@ -497,6 +510,86 @@ input[type=range]::-moz-range-thumb { touch-action: none; } +/* 3D Rotation buttons */ +.rotate-buttons { + position: fixed; + bottom: 20px; + right: 20px; + display: flex; + flex-direction: column; + gap: 10px; + z-index: 100; +} + +.rotate-btn { + background: linear-gradient(45deg, #007bff, #00ddff); + color: white; + border: none; + padding: 12px 15px; + border-radius: 50px; + font-size: 14px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + transition: all 0.2s ease; + font-weight: bold; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); +} + +.rotate-btn:active { + transform: scale(0.95); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + background: linear-gradient(45deg, #0062cc, #00b3ff); +} + +/* Performance toggle */ +.perf-toggle { + display: flex; + align-items: center; + margin-top: 5px; + background: rgba(0, 0, 0, 0.3); + padding: 5px; + border-radius: 4px; + font-size: 11px; +} + +.perf-label { + margin-left: 5px; + color: #00ffff; + cursor: pointer; +} + +#toggle-mobile-performance { + cursor: pointer; +} + +/* Mobile mode adjustments for rotation buttons */ +.mobile-mode .rotate-buttons { + bottom: 15px; + right: 15px; + gap: 8px; +} + +.mobile-mode .rotate-btn { + padding: 10px 12px; + font-size: 12px; +} + +/* Mobile landscape orientation */ +@media (orientation: landscape) { + .mobile-mode .rotate-buttons { + flex-direction: row; + bottom: 10px; + right: 10px; + } +} + +/* Smaller devices */ +@media (max-width: 400px) { + .mobile-mode .rotate-btn { + padding: 8px 10px; + font-size: 11px; + } +} + .mobile-mode .game-container { flex-direction: row; align-items: flex-start;