OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class Balls { | 5 class Balls { |
6 static final double RADIUS2 = Ball.RADIUS * Ball.RADIUS; | 6 static final double RADIUS2 = Ball.RADIUS * Ball.RADIUS; |
7 | 7 |
8 // TODO: "static const Array<String> PNGS" doesn't parse | 8 // TODO: "static const Array<String> PNGS" doesn't parse |
9 static final List<String> PNGS = ["images/ball-d9d9d9.png", | 9 static final List<String> PNGS = const ["images/ball-d9d9d9.png", |
10 "images/ball-009a49.png", "images/ball-13acfa.png", | 10 "images/ball-009a49.png", "images/ball-13acfa.png", |
11 "images/ball-265897.png", "images/ball-b6b4b5.png", | 11 "images/ball-265897.png", "images/ball-b6b4b5.png", |
12 "images/ball-c0000b.png", "images/ball-c9c9c9.png"]; | 12 "images/ball-c0000b.png", "images/ball-c9c9c9.png"]; |
13 | 13 |
14 HTMLDivElement root; | 14 HTMLDivElement root; |
15 int lastTime; | 15 int lastTime; |
16 List<Ball> balls; | 16 List<Ball> balls; |
17 | 17 |
18 Balls() : | 18 Balls() : |
19 lastTime = Util.currentTimeMillis(), | 19 lastTime = Util.currentTimeMillis(), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 double ndx = (nb0x - nb1x).abs(); | 85 double ndx = (nb0x - nb1x).abs(); |
86 double ndy = (nb0y - nb1y).abs(); | 86 double ndy = (nb0y - nb1y).abs(); |
87 double nd2 = ndx * ndx + ndy * ndy; | 87 double nd2 = ndx * ndx + ndy * ndy; |
88 return nd2; | 88 return nd2; |
89 } | 89 } |
90 | 90 |
91 void add(int x, int y, int color) { | 91 void add(int x, int y, int color) { |
92 balls.add(new Ball(root, x, y, color)); | 92 balls.add(new Ball(root, x, y, color)); |
93 } | 93 } |
94 } | 94 } |
OLD | NEW |