Moved the score to center of the screen

master
Abhinav Sarkar 9 years ago
parent 3b4171c716
commit daae81a751
  1. 8
      resources/public/index.html
  2. 3
      src/cljs/frpong/core.cljs

@ -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

@ -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*)

Loading…
Cancel
Save