Moved the score to center of the screen

master
Abhinav Sarkar 2013-10-15 19:30:06 +05:30
parent 3b4171c716
commit daae81a751
2 changed files with 10 additions and 1 deletions

View File

@ -34,6 +34,12 @@ body {
#canvas {
border: 2px green solid;
}
#score {
font-size: 70px;
text-anchor: middle;
dominant-baseline: central;
}
</style>
</head>
<body>
@ -49,13 +55,13 @@ body {
</span>
</div>
<svg id="canvas">
<text id="score">0</text>
<circle id="ball" />
<rect id="lpaddle" />
<rect id="rpaddle" />
</svg>
<div>
<div style="float: left">
score <span id="score">0</span>
fps <span id="fps">0</span>
</div>
use W-S keys to move the left paddle and Up-Down arrow keys to move the right paddle

View File

@ -86,6 +86,9 @@
(dom/set-attr! "r" *ball-radius*)
(dom/set-attr! "cx" (first *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"]]
(doto (dom/by-id id)
(dom/set-attr! "width" *paddle-width*)