Example #1
0
 @Override
 public synchronized void update(double time) {
   xCtrl.update(time);
   yCtrl.update(time);
   directionCtrl.update(time);
   textManager.update(time);
 }
Example #2
0
  public synchronized void draw(Canvas canvas) {
    Transformation2D parent = canvas.getTransformation();
    Transformation2D t = g2d.translate(xCtrl.getCurrent() * 100.0, yCtrl.getCurrent() * 100.0);
    Transformation2D r =
        g2d.rotate(directionCtrl.getCurrent() * Math.PI * -0.5, g2d.newPoint2D(50, 50));
    Transformation2D pt = g2d.combine(parent, t);
    Transformation2D ptr = g2d.combine(pt, r);

    canvas.setTransformation(ptr);
    antDrawer.drawAnt(canvas, antInfo);
    canvas.setTransformation(pt);
    textManager.draw(canvas);
    canvas.setTransformation(parent);
  }
Example #3
0
 private void say(String text, Color color) {
   Point2D startPos = g2d.newPoint2D(50, 50);
   Point2D endPos;
   switch (textDirection) {
     case 0:
       endPos = g2d.newPoint2D(80, 80);
       textDirection = 1;
       break;
     case 1:
       endPos = g2d.newPoint2D(80, 20);
       textDirection = 2;
       break;
     case 2:
       endPos = g2d.newPoint2D(20, 20);
       textDirection = 3;
       break;
     default:
       endPos = g2d.newPoint2D(20, 80);
       textDirection = 0;
       break;
   }
   TextVisual tv = new TextVisual(g2d, text, color, startPos, endPos, 10.0, 30.0, 2.0);
   textManager.addVisual(tv);
 }