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