Simplify start overlay and remove grid
Browse files- app/LogoBreakout.tsx +28 -32
- app/globals.css +6 -0
app/LogoBreakout.tsx
CHANGED
|
@@ -470,23 +470,6 @@ export function LogoBreakout() {
|
|
| 470 |
context.fillStyle = "#ffffff";
|
| 471 |
context.fillRect(0, 0, WIDTH, HEIGHT);
|
| 472 |
|
| 473 |
-
context.save();
|
| 474 |
-
context.strokeStyle = "rgba(17, 17, 17, 0.045)";
|
| 475 |
-
context.lineWidth = 1;
|
| 476 |
-
for (let x = 0; x <= WIDTH; x += 40) {
|
| 477 |
-
context.beginPath();
|
| 478 |
-
context.moveTo(x, 0);
|
| 479 |
-
context.lineTo(x, HEIGHT);
|
| 480 |
-
context.stroke();
|
| 481 |
-
}
|
| 482 |
-
for (let y = 0; y <= HEIGHT; y += 40) {
|
| 483 |
-
context.beginPath();
|
| 484 |
-
context.moveTo(0, y);
|
| 485 |
-
context.lineTo(WIDTH, y);
|
| 486 |
-
context.stroke();
|
| 487 |
-
}
|
| 488 |
-
context.restore();
|
| 489 |
-
|
| 490 |
for (const brick of game.bricks) {
|
| 491 |
if (!brick.alive) continue;
|
| 492 |
context.save();
|
|
@@ -576,7 +559,7 @@ export function LogoBreakout() {
|
|
| 576 |
update(game, delta);
|
| 577 |
draw(game);
|
| 578 |
} else {
|
| 579 |
-
context.fillStyle = "#
|
| 580 |
context.fillRect(0, 0, WIDTH, HEIGHT);
|
| 581 |
}
|
| 582 |
frame = requestAnimationFrame(loop);
|
|
@@ -606,10 +589,10 @@ export function LogoBreakout() {
|
|
| 606 |
action: "Please wait",
|
| 607 |
},
|
| 608 |
ready: {
|
| 609 |
-
kicker:
|
| 610 |
-
title:
|
| 611 |
-
copy: "
|
| 612 |
-
action:
|
| 613 |
},
|
| 614 |
paused: {
|
| 615 |
kicker: "Field suspended",
|
|
@@ -692,23 +675,36 @@ export function LogoBreakout() {
|
|
| 692 |
/>
|
| 693 |
{overlay && (
|
| 694 |
<div className="game-overlay">
|
| 695 |
-
|
| 696 |
-
<p className="overlay-kicker">{overlay.kicker}</p>
|
| 697 |
-
<h2>{overlay.title}</h2>
|
| 698 |
-
<p>{overlay.copy}</p>
|
| 699 |
<button
|
| 700 |
-
className="launch-button"
|
| 701 |
type="button"
|
| 702 |
onClick={(event) => {
|
| 703 |
event.stopPropagation();
|
| 704 |
-
|
| 705 |
-
else launch();
|
| 706 |
}}
|
| 707 |
-
disabled={status === "loading"}
|
| 708 |
>
|
| 709 |
-
|
| 710 |
</button>
|
| 711 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
</div>
|
| 713 |
)}
|
| 714 |
</div>
|
|
|
|
| 470 |
context.fillStyle = "#ffffff";
|
| 471 |
context.fillRect(0, 0, WIDTH, HEIGHT);
|
| 472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
for (const brick of game.bricks) {
|
| 474 |
if (!brick.alive) continue;
|
| 475 |
context.save();
|
|
|
|
| 559 |
update(game, delta);
|
| 560 |
draw(game);
|
| 561 |
} else {
|
| 562 |
+
context.fillStyle = "#ffffff";
|
| 563 |
context.fillRect(0, 0, WIDTH, HEIGHT);
|
| 564 |
}
|
| 565 |
frame = requestAnimationFrame(loop);
|
|
|
|
| 589 |
action: "Please wait",
|
| 590 |
},
|
| 591 |
ready: {
|
| 592 |
+
kicker: "",
|
| 593 |
+
title: "",
|
| 594 |
+
copy: "",
|
| 595 |
+
action: "Start",
|
| 596 |
},
|
| 597 |
paused: {
|
| 598 |
kicker: "Field suspended",
|
|
|
|
| 675 |
/>
|
| 676 |
{overlay && (
|
| 677 |
<div className="game-overlay">
|
| 678 |
+
{status === "ready" ? (
|
|
|
|
|
|
|
|
|
|
| 679 |
<button
|
| 680 |
+
className="launch-button start-button"
|
| 681 |
type="button"
|
| 682 |
onClick={(event) => {
|
| 683 |
event.stopPropagation();
|
| 684 |
+
launch();
|
|
|
|
| 685 |
}}
|
|
|
|
| 686 |
>
|
| 687 |
+
Start
|
| 688 |
</button>
|
| 689 |
+
) : (
|
| 690 |
+
<div className="overlay-card">
|
| 691 |
+
<p className="overlay-kicker">{overlay.kicker}</p>
|
| 692 |
+
<h2>{overlay.title}</h2>
|
| 693 |
+
<p>{overlay.copy}</p>
|
| 694 |
+
<button
|
| 695 |
+
className="launch-button"
|
| 696 |
+
type="button"
|
| 697 |
+
onClick={(event) => {
|
| 698 |
+
event.stopPropagation();
|
| 699 |
+
if (status === "paused") togglePause();
|
| 700 |
+
else launch();
|
| 701 |
+
}}
|
| 702 |
+
disabled={status === "loading"}
|
| 703 |
+
>
|
| 704 |
+
{overlay.action}
|
| 705 |
+
</button>
|
| 706 |
+
</div>
|
| 707 |
+
)}
|
| 708 |
</div>
|
| 709 |
)}
|
| 710 |
</div>
|
app/globals.css
CHANGED
|
@@ -207,6 +207,12 @@ main {
|
|
| 207 |
background: var(--cyan);
|
| 208 |
}
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
.launch-button:disabled {
|
| 211 |
opacity: 0.45;
|
| 212 |
cursor: wait;
|
|
|
|
| 207 |
background: var(--cyan);
|
| 208 |
}
|
| 209 |
|
| 210 |
+
.start-button {
|
| 211 |
+
min-width: 132px;
|
| 212 |
+
padding: 16px 30px;
|
| 213 |
+
font-size: 15px;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
.launch-button:disabled {
|
| 217 |
opacity: 0.45;
|
| 218 |
cursor: wait;
|