Moved the score to center of the screen
parent
3b4171c716
commit
daae81a751
|
@ -34,6 +34,12 @@ body {
|
||||||
#canvas {
|
#canvas {
|
||||||
border: 2px green solid;
|
border: 2px green solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#score {
|
||||||
|
font-size: 70px;
|
||||||
|
text-anchor: middle;
|
||||||
|
dominant-baseline: central;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -49,13 +55,13 @@ body {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<svg id="canvas">
|
<svg id="canvas">
|
||||||
|
<text id="score">0</text>
|
||||||
<circle id="ball" />
|
<circle id="ball" />
|
||||||
<rect id="lpaddle" />
|
<rect id="lpaddle" />
|
||||||
<rect id="rpaddle" />
|
<rect id="rpaddle" />
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style="float: left">
|
<div style="float: left">
|
||||||
score <span id="score">0</span>
|
|
||||||
fps <span id="fps">0</span>
|
fps <span id="fps">0</span>
|
||||||
</div>
|
</div>
|
||||||
use W-S keys to move the left paddle and Up-Down arrow keys to move the right paddle
|
use W-S keys to move the left paddle and Up-Down arrow keys to move the right paddle
|
||||||
|
|
|
@ -86,6 +86,9 @@
|
||||||
(dom/set-attr! "r" *ball-radius*)
|
(dom/set-attr! "r" *ball-radius*)
|
||||||
(dom/set-attr! "cx" (first *center*))
|
(dom/set-attr! "cx" (first *center*))
|
||||||
(dom/set-attr! "cy" (second *center*)))
|
(dom/set-attr! "cy" (second *center*)))
|
||||||
|
(doto (dom/by-id "score")
|
||||||
|
(dom/set-attr! "x" (first *center*))
|
||||||
|
(dom/set-attr! "y" (second *center*)))
|
||||||
(doseq [id ["lpaddle" "rpaddle"]]
|
(doseq [id ["lpaddle" "rpaddle"]]
|
||||||
(doto (dom/by-id id)
|
(doto (dom/by-id id)
|
||||||
(dom/set-attr! "width" *paddle-width*)
|
(dom/set-attr! "width" *paddle-width*)
|
||||||
|
|
Loading…
Reference in New Issue