Commit | Line | Data |
---|---|---|
2ca06388 | 1 | import java.util.Hashtable; |
fe0cb084 BM |
2 | class Graphic |
3 | { | |
4 | public int position = 0; | |
5 | public ArrayList<Integer> graphicBuffer; | |
6 | ||
7 | Graphic() | |
8 | { | |
9 | graphicBuffer = new ArrayList<Integer>(); | |
10 | } | |
11 | ||
12 | ||
13 | }; | |
14 | class GranimPattern extends SCPattern | |
15 | { | |
2ca06388 | 16 | Hashtable<String,Graphic> displayList; |
fe0cb084 BM |
17 | |
18 | GranimPattern(GLucose glucose) | |
19 | { | |
20 | super(glucose); | |
2ca06388 | 21 | displayList = new Hashtable<String,Graphic>(); |
fe0cb084 BM |
22 | } |
23 | ||
2ca06388 | 24 | public void addGraphic(String name, Graphic g) |
fe0cb084 | 25 | { |
2ca06388 | 26 | displayList.put(name,g); |
fe0cb084 BM |
27 | } |
28 | ||
29 | public void run(int deltaMs) | |
30 | { | |
2ca06388 | 31 | for(Graphic g : displayList.values()) |
fe0cb084 BM |
32 | { |
33 | List<Point> drawList = model.points.subList(g.position, g.position + g.graphicBuffer.size()); | |
34 | ||
35 | for (int i=0; i < drawList.size(); i++) | |
36 | { | |
37 | colors[drawList.get(i).index] = (int) g.graphicBuffer.get(i); | |
38 | } | |
39 | } | |
40 | } | |
41 | ||
42 | }; | |
43 | ||
44 | class RedThreeGraphic extends Graphic | |
45 | { | |
46 | RedThreeGraphic() | |
47 | { | |
48 | super(); | |
49 | prepare(); | |
50 | } | |
51 | public void prepare() | |
52 | { | |
53 | for(int i=0; i < 3 ;i++) | |
54 | { | |
55 | graphicBuffer.add(color(0,255,255)); | |
56 | } | |
57 | } | |
58 | }; |