You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
795 B

  1. package rendering;
  2. import gameobjects.GameObject;
  3. import java.awt.Color;
  4. import java.awt.Graphics2D;
  5. public class RectArtist extends Artist {
  6. protected Color color;
  7. protected double width, height;
  8. public RectArtist(GameObject go, double width, double height, Color color) {
  9. super(go);
  10. this.color = color;
  11. this.width = width;
  12. this.height = height;
  13. }
  14. @Override
  15. public void draw(Graphics2D g) {
  16. g.setColor(this.color);
  17. // g.drawLine((int) (Math.round(this.getX())), (int) (Math.round(this.getY()-this.height/2.)),
  18. // (int) Math.round(this.getX()),
  19. // (int) Math.round(this.getY() + this.height/2.));
  20. g.fillRect((int) (this.getX() - this.width / 2.), (int) (this.getY() - this.height / 2.),
  21. (int) this.width, (int) this.height);
  22. }
  23. }