Package net.sf.robocode.robotpaint

Examples of net.sf.robocode.robotpaint.Graphics2DSerialized


  }

  @SuppressWarnings("serial")
  @Test
  public void graphics() throws InterruptedException {
    final Graphics2DSerialized sg = new Graphics2DSerialized();

    sg.setPaintingEnabled(true);
    sg.setBackground(Color.GREEN);
    sg.setColor(Color.RED);
    Arc2D a = new Arc2D.Double(Arc2D.PIE);

    a.setAngleExtent(10);
    a.setAngleStart(-30);
    a.setFrame(0, 0, 80, 80);
    sg.draw(a);

    sg.setColor(Color.BLUE);
    sg.draw(new Line2D.Double(99, 98, 78, 3));

    sg.setColor(Color.YELLOW);
    sg.draw(new Rectangle2D.Double(20, 20, 30, 50));

    sg.setColor(Color.BLACK);
    sg.drawLine(99, 3, 78, 3);
    sg.drawRect(90, 20, 30, 50);

    sg.setColor(Color.CYAN);

    sg.setStroke(new BasicStroke(1, 2, BasicStroke.JOIN_ROUND, 4, null, 0));
    sg.fill(new Rectangle2D.Double(20, 70, 30, 50));
    sg.fill(new Ellipse2D.Double(70, 70, 30, 50));

    sg.setColor(Color.MAGENTA);
    sg.fill(new RoundRectangle2D.Double(110, 70, 30, 50, 13.5, 16.1));

    exception = null;
   
    Canvas d = new Canvas() {
      @Override
      public void paint(Graphics g) {
        synchronized (this) {
          try {
            sg.processTo((Graphics2D) g);
          } catch (Exception e) {
            exception = e;
          }
        }
      }
View Full Code Here


    }
  }

  private IGraphicsProxy getRobotGraphics(int robotIndex) {
    if (robotGraphics[robotIndex] == null) {
      robotGraphics[robotIndex] = new Graphics2DSerialized();
      robotGraphics[robotIndex].setPaintingEnabled(true);
    }
    return robotGraphics[robotIndex];
  }
View Full Code Here

  BasicRobotProxy(IRobotItem specification, IHostManager hostManager, IRobotPeer peer, RobotStatics statics) {
    super(specification, hostManager, peer, statics);

    eventManager = new EventManager(this);

    graphicsProxy = new Graphics2DSerialized();

    // dummy
    execResults = new ExecResults(null, null, null, null, null, false, false, false);

    setSetCallCount(0);
View Full Code Here

TOP

Related Classes of net.sf.robocode.robotpaint.Graphics2DSerialized

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.