public void display(PApplet theApplet, Controller theController) { theApplet.translate(_myRadius, _myRadius); theApplet.pushMatrix(); theApplet.pushStyle(); theApplet.ellipseMode(PApplet.CENTER); theApplet.noStroke(); theApplet.fill(color().colorBackground); theApplet.ellipse(0, 0, _myRadius * 2, _myRadius * 2); theApplet.popMatrix(); theApplet.pushMatrix(); if (displayStyle == LINE) { theApplet.rotate(myAngle); theApplet.stroke(color().colorForeground); theApplet.line(0, 0, _myRadius, 0); } else if (displayStyle == ELLIPSE) { theApplet.rotate(myAngle); theApplet.noStroke(); theApplet.fill(color().colorForeground); theApplet.ellipse(_myRadius * 0.75f, 0, _myRadius * 0.2f, _myRadius * 0.2f); } else if (displayStyle == ARC) { theApplet.noStroke(); theApplet.fill(color().colorForeground); theApplet.arc(0, 0, _myRadius * 1.8f, _myRadius * 1.8f, startAngle, myAngle); theApplet.fill(color().colorBackground); theApplet.ellipse(0, 0, _myRadius * 1.2f, _myRadius * 1.2f); } theApplet.popMatrix(); theApplet.pushMatrix(); theApplet.rotate(startAngle); if (isShowTickMarks) { float step = range / _myTickMarksNum; theApplet.stroke(color().colorForeground); theApplet.strokeWeight(myTickMarkWeight); for (int i = 0; i <= _myTickMarksNum; i++) { theApplet.line(_myRadius + 2, 0, _myRadius + myTickMarkLength + 2, 0); theApplet.rotate(step); } } else { if (isShowRange) { theApplet.stroke(color().colorForeground); theApplet.strokeWeight(myTickMarkWeight); theApplet.line(_myRadius + 2, 0, _myRadius + myTickMarkLength + 2, 0); theApplet.rotate(range); theApplet.line(_myRadius + 2, 0, _myRadius + myTickMarkLength + 2, 0); } } theApplet.noStroke(); theApplet.popStyle(); theApplet.popMatrix(); }
public void drawCollisionShapes() { p.fill(255, 0, 0, 50); for (CollisionCircle circle : collisionShapes.values()) { p.stroke(0, 2); p.ellipse(circle.center.x, circle.center.y, circle.radius, circle.radius); } }
/** Display the Repeller */ public void display() { p.stroke(color1); if (dragging) p.fill(Style.textColorBlk); else if (rollover) p.fill(color2); else p.noFill(); p.ellipse(getLoc().x, getLoc().y, radius * 2, radius * 2); }
public void thinkAndMove(final PApplet p) { // initial frame use only if (x == -1) x = p.width / 2; if (y == -1) y = p.height / 3; target_x = ball.x; target_y = ball.y - DESIRED_DIST_BEHIND; // want to get behind the ball final float diff_x = target_x - x; final float diff_y = target_y - y; if (diff_x < MAX_VELOCITY_X) { x = target_x; } else { if (x < target_x) x += MAX_VELOCITY_X; else if (x > target_x) x -= MAX_VELOCITY_X; } if (diff_y < MAX_VELOCITY_Y) { y = target_y; } else { if (y > target_y) y -= MAX_VELOCITY_Y; else if (y < target_y) y += MAX_VELOCITY_Y; } p.colorMode(PConstants.RGB); p.fill(255, 0, 0); p.ellipse(x, y, 5, 5); if (y < p.height / 3) { fluid.addForce(p, (x - 5) / p.width, y / p.height, 0, MAX_FORCE / p.height); fluid.addForce(p, (x) / p.width, y / p.height, 0, MAX_FORCE / p.height); fluid.addForce(p, (x + 5) / p.width, y / p.height, 0, MAX_FORCE / p.height); } }
public void draw(PApplet canvas, float scale) { PVector orient = PVector.fromAngle(orientation); orient.mult(scale * getRadius()); float x = (float) position.x * scale; float y = (float) position.y * scale; float diameter = getRadius() * 2 * scale; canvas.fill(teamColor); canvas.stroke(0); canvas.ellipse(x, y, diameter, diameter); canvas.line(x, y, x + (float) orient.x, y + (float) orient.y); // Delegate Decoration to Robot float heading = orient.heading(); float drawScale = 100f / scale * getRadius(); canvas.translate(x, y); canvas.rotate(heading); canvas.scale(drawScale); // TODO: How to resolve scale, so that teams don't have to mind it also... decorateRobot(canvas); canvas.scale(1f / drawScale); canvas.rotate(-heading); canvas.translate(-x, -y); }
public static void staticDisplay(PApplet main, char player, int width, int height) { String name = "Knight"; if (player == Chess.WHITE) { main.stroke(255); main.fill(255); main.ellipse(width, height, 40, 40); main.stroke(0); main.fill(0); main.text(name, width - 15, height + 5); } else { main.stroke(0); main.fill(0); main.ellipse(width, height, 40, 40); main.stroke(255); main.fill(255); main.text(name, width - 15, height + 5); } // end if-else } // end staticDisplay()
@Override public void display() { if (isDisplay) { context.fill(0, 80); // rect(xpos, ypos, width, width); context.fill(196, 196, 196, 80); context.ellipse(xpos + width / 2, ypos + width / 2, width, width); context.fill(255); context.ellipse(xpos + width / 2, ypos + width / 2, width / 2, width / 2); if (isSelected) { context.fill(255, 196, 13); context.ellipse(xpos + width / 2, ypos + width / 2, width / 2, width / 2); } context.fill(255); context.textSize(10); context.text("Bus Number", xpos - width, ypos + 3 * height / 2); } }
public void draw(PApplet p) { p.fill(_color); p.ellipse(BomberMan.TILE_SIZE / 2, BomberMan.TILE_SIZE / 2, DIAMETER, DIAMETER); }
public void draw(final PApplet p, final Game g, final PlasmaFluid fluid) { p.pushStyle(); p.stroke(255); p.strokeWeight(3); p.fill(150, 150); p.ellipseMode(PApplet.CENTER); p.rectMode(PApplet.CORNER); if (g.mode == Game.PREGAME_WAIT || g.mode == Game.JUST_SCORED || g.mode == Game.JUST_SCORED_WAIT) { int numcircles = 0; final int count = g.modeFrameCountdown; if (count > (Const.PREGAME_WAIT_COUNT * 2 / 3)) { numcircles = 3; } else if (count > (Const.PREGAME_WAIT_COUNT / 3)) { numcircles = 2; } else { numcircles = 1; } final float stepsize = width / 8; final float size = width / 9f; if (numcircles > 2) { p.ellipse(stepsize * 2, height / 2, size * 0.75f, size * 0.75f); p.ellipse(stepsize * 6, height / 2, size * 0.75f, size * 0.75f); } if (numcircles > 1) { p.ellipse(stepsize * 5, height / 2, size * 0.9f, size * 0.9f); p.ellipse(stepsize * 3, height / 2, size * 0.9f, size * 0.9f); } p.ellipse(stepsize * 4, height / 2, size, size); if (numcircles == 2 && numcircles != lastnum) { fluid.addForce( p, (stepsize * 2) / width, 0.5f, -forceval * (1 + r.nextFloat()), 0, Const.OTHER_OFFSET, colorval); fluid.addForce( p, (stepsize * 6) / width, 0.5f, forceval * (1 + r.nextFloat()), 0, Const.OTHER_OFFSET, colorval); } if (numcircles == 1 && numcircles != lastnum) { fluid.addForce( p, (stepsize * 5) / width, 0.5f, 0, forceval * (1 + r.nextFloat()), Const.OTHER_OFFSET, colorval); fluid.addForce( p, (stepsize * 3) / width, 0.5f, 0, -forceval * (1 + r.nextFloat()), Const.OTHER_OFFSET, colorval); } // if (numcircles == 1 && count == 0) { // fluid.addForce(p, (stepsize*4.2f)/width, 0.5f, 0, forceval*(1+r.nextFloat()), // Const.OTHER_OFFSET, colorval); // fluid.addForce(p, (stepsize*3.8f)/width, 0.5f, 0, -forceval*(1+r.nextFloat()), // Const.OTHER_OFFSET, colorval); // } lastnum = numcircles; } else if (g.mode == Game.GAME_OVER) { p.stroke(255); p.fill(255); p.rect(width / 2, height / 2, g.modeFrameCountdown * 3, 30); } p.popStyle(); }