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 | ||
27e9754c BM |
29 | public Graphic getGraphicByName(String name) |
30 | { | |
31 | return displayList.get(name); | |
32 | } | |
33 | ||
fe0cb084 BM |
34 | public void run(int deltaMs) |
35 | { | |
2ca06388 | 36 | for(Graphic g : displayList.values()) |
fe0cb084 BM |
37 | { |
38 | List<Point> drawList = model.points.subList(g.position, g.position + g.graphicBuffer.size()); | |
39 | ||
40 | for (int i=0; i < drawList.size(); i++) | |
41 | { | |
42 | colors[drawList.get(i).index] = (int) g.graphicBuffer.get(i); | |
43 | } | |
44 | } | |
45 | } | |
46 | ||
47 | }; | |
48 | ||
49 | class RedThreeGraphic extends Graphic | |
50 | { | |
51 | RedThreeGraphic() | |
52 | { | |
53 | super(); | |
54 | prepare(); | |
55 | } | |
56 | public void prepare() | |
57 | { | |
58 | for(int i=0; i < 3 ;i++) | |
59 | { | |
60 | graphicBuffer.add(color(0,255,255)); | |
61 | } | |
62 | } | |
63 | }; |