/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */ public void arc (float x, float y, float radius, float start, float degrees) { arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f)))); }
/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */ public void arc (float x, float y, float radius, float start, float degrees) { arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f)))); }
/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */ public void arc (float x, float y, float radius, float start, float degrees) { arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f)))); }
private void drawBgTop() { float d = height * 0.004f; float h = 0.025f; rend.rect(game.WIDTH * 0.1f + d, height * 0.3f + d, game.WIDTH * 0.8f - d * 2, height * h - d * 2, color1, color2, color2, color1); rend.setColor(color2); rend.arc(game.WIDTH * 0.9f - d, height * (0.3f + h * 0.5f), height * h * 0.5f - d, 270, 180); rend.setColor(color1); rend.arc(game.WIDTH * 0.1f + d, height * (0.3f + h * 0.5f), height * h * 0.5f - d, 90, 180); }
private void drawLoad() { float d = height * 0.004f; float h = 0.025f; rend.rect(game.WIDTH * 0.1f + d, height * 0.3f + d, (game.WIDTH * 0.8f - d * 2) * load, height * h - d * 2, color5, color6, color6, color5); rend.setColor(color6); rend.arc(game.WIDTH * 0.1f + d + (game.WIDTH * 0.8f - d * 2) * load, height * (0.3f + h * 0.5f), height * h * 0.5f - d, 270, 180); rend.setColor(color5); rend.arc(game.WIDTH * 0.1f + d, height * (0.3f + h * 0.5f), height * h * 0.5f - d, 90, 180); }
private void drawBgRect(float x, float y, float width, float height) { rend.setColor(outColor); rend.rect(x + radius, y + height - radius / 2, width - radius * 2, radius / 2); rend.arc(x + width - radius, y + height - radius, radius, 0, 90); rend.arc(x + radius, y + height - radius, radius, 90, 90); rend.setColor(outColor); rend.rect(x + radius, y, width - radius * 2, radius / 2); rend.arc(x + radius, y + radius, radius, 180, 90); rend.arc(x + width - radius, y + radius, radius, 270, 90); rend.rect(x, y + radius, radius / 2, height - radius * 2); rend.rect(x + width - radius / 2, y + radius, radius / 2, height - radius * 2); }
private void drawCircleRect(float x, float y, float width, float height) { rend.setColor(col1); rend.rect(x + radius, y + height - radius, width - radius * 2, radius); rend.arc(x + width - radius, y + height - radius, radius, 0, 90); rend.arc(x + radius, y + height - radius, radius, 90, 90); rend.setColor(col2); rend.rect(x + radius, y, width - radius * 2, radius); rend.arc(x + radius, y + radius, radius, 180, 90); rend.arc(x + width - radius, y + radius, radius, 270, 90); rend.rect(x, y + radius, radius / 2, height - radius * 2, col2, col2, col1, col1); rend.rect(x + width - radius / 2, y + radius, radius / 2, height - radius * 2, col2, col2, col1, col1); rend.rect(x, y + radius, width, height - radius * 2, col2, col2, col1, col1); }
private void drawSmileyFace(ShapeRenderer renderer) { // TODO: Set the color to yellow, and draw the face renderer.setColor(Color.YELLOW); renderer.circle(FACE_CENTER_X, FACE_CENTER_Y, FACE_RADIUS, FACE_SEGMENTS); // TODO: Set the color to black and draw the eyes renderer.setColor(Color.BLACK); renderer.circle(FACE_CENTER_X - EYE_OFFSET, FACE_CENTER_Y + EYE_OFFSET, EYE_RADIUS, EYE_SEGMENTS); renderer.circle(FACE_CENTER_X + EYE_OFFSET, FACE_CENTER_Y + EYE_OFFSET, EYE_RADIUS, EYE_SEGMENTS); // TODO: Draw a black arc for the mouth (Hint: MOUTH_OUTER_RADIUS) renderer.arc(FACE_CENTER_X, FACE_CENTER_Y, MOUTH_OUTER_RADIUS, MOUTH_START_ANGLE, MOUTH_DEGREES, MOUTH_SEGMENTS); // TODO: Draw a yellow arc to make the mouth actually look like a mouth (Hint: MOUTH_INNER_RADIUS) renderer.setColor(Color.YELLOW); renderer.arc(FACE_CENTER_X, FACE_CENTER_Y, MOUTH_INNER_RADIUS, MOUTH_START_ANGLE, MOUTH_DEGREES, MOUTH_SEGMENTS); } }
private void drawBg() { rend.setColor(Color.BLACK); rend.rect(0, 0, getWidth(), getHeight()); float h = 0.025f; rend.setColor(Color.WHITE); rend.rect(game.WIDTH * 0.1f, height * 0.3f, game.WIDTH * 0.8f, height * h, color3, color4, color4, color3); rend.setColor(color4); rend.arc(game.WIDTH * 0.9f, height * (0.3f + h * 0.5f), height * h * 0.5f, 270, 180); rend.setColor(color3); rend.arc(game.WIDTH * 0.1f, height * (0.3f + h * 0.5f), height * h * 0.5f, 90, 180); }