OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of clock; | 5 part of clock; |
6 | 6 |
7 class ClockNumber { | 7 class ClockNumber { |
8 static const int WIDTH = 4; | 8 static const int WIDTH = 4; |
9 static const int HEIGHT = 7; | 9 static const int HEIGHT = 7; |
10 | 10 |
11 CountDownClock app; | 11 CountDownClock app; |
12 Element root; | 12 Element root; |
13 List<List<ImageElement>> imgs; | 13 List<List<ImageElement>> imgs; |
14 List<List<int>> pixels; | 14 List<List<int>> pixels; |
15 int ballColor; | 15 int ballColor; |
16 | 16 |
17 ClockNumber(this.app, double pos, this.ballColor) { | 17 ClockNumber(this.app, double pos, this.ballColor) { |
18 imgs = new List<List<ImageElement>>(HEIGHT); | 18 imgs = new List<List<ImageElement>>(HEIGHT); |
19 | 19 |
20 root = new DivElement(); | 20 root = new DivElement(); |
21 makeAbsolute(root); | 21 makeAbsolute(root); |
22 setElementPosition(root, pos, 0.0); | 22 setElementPosition(root, pos, 0.0); |
23 | 23 |
24 for (int y = 0; y < HEIGHT; ++y) { | 24 for (int y = 0; y < HEIGHT; ++y) { |
25 imgs[y] = new List<ImageElement>.fixedLength(WIDTH); | 25 imgs[y] = new List<ImageElement>(WIDTH); |
26 } | 26 } |
27 | 27 |
28 for (int y = 0; y < HEIGHT; ++y) { | 28 for (int y = 0; y < HEIGHT; ++y) { |
29 for (int x = 0; x < WIDTH; ++x) { | 29 for (int x = 0; x < WIDTH; ++x) { |
30 imgs[y][x] = new ImageElement(); | 30 imgs[y][x] = new ImageElement(); |
31 root.nodes.add(imgs[y][x]); | 31 root.nodes.add(imgs[y][x]); |
32 makeAbsolute(imgs[y][x]); | 32 makeAbsolute(imgs[y][x]); |
33 setElementPosition(imgs[y][x], | 33 setElementPosition(imgs[y][x], |
34 x * CountDownClock.BALL_WIDTH, y * CountDownClock.BALL_HEIGHT); | 34 x * CountDownClock.BALL_WIDTH, y * CountDownClock.BALL_HEIGHT); |
35 } | 35 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const[ 1, 1, 1, 1 ], | 159 const[ 1, 1, 1, 1 ], |
160 const[ 1, 0, 0, 1 ], | 160 const[ 1, 0, 0, 1 ], |
161 const[ 1, 0, 0, 1 ], | 161 const[ 1, 0, 0, 1 ], |
162 const[ 1, 1, 1, 1 ], | 162 const[ 1, 1, 1, 1 ], |
163 const[ 0, 0, 0, 1 ], | 163 const[ 0, 0, 0, 1 ], |
164 const[ 0, 0, 0, 1 ], | 164 const[ 0, 0, 0, 1 ], |
165 const[ 1, 1, 1, 1 ] | 165 const[ 1, 1, 1, 1 ] |
166 ] | 166 ] |
167 ]; | 167 ]; |
168 } | 168 } |
OLD | NEW |