Esempio n. 1
0
 private void paintLifes(Graphics2D g2d) {
   int lifes = c.getLifes();
   for (int i = 0; i < lifes; i++) {
     ImageIcon imageIcon =
         new ImageIcon(
             ItemFactory.class.getResource(Config.getImagePath() + Level.getLevel().getLife()));
     Life life =
         ItemFactory.createLife(
             Config.getBoardDimension().getLength() - (2 + i) * imageIcon.getIconWidth(),
             0,
             imageIcon);
     g2d.drawImage(life.getImage(), life.getPosition().getX(), life.getPosition().getY(), this);
   }
 }
Esempio n. 2
0
 private void paintBackground(Graphics2D g2d) {
   int x = c.getBackground().getPosition().getX();
   int y = c.getBackground().getPosition().getY();
   g2d.drawImage(
       c.getBackground().getImage(),
       x - c.getBackground().getDimension().getLength(),
       y,
       Config.getBoardDimension().getLength(),
       Config.getBoardDimension().getHeight(),
       this);
   g2d.drawImage(
       c.getBackground().getImage(),
       x,
       y,
       Config.getBoardDimension().getLength(),
       Config.getBoardDimension().getHeight(),
       this);
   g2d.drawImage(
       c.getBackground().getImage(),
       x + c.getBackground().getDimension().getLength(),
       y,
       Config.getBoardDimension().getLength(),
       Config.getBoardDimension().getHeight(),
       this);
   if (Config.getForeground().compareTo("") == 0) {
     ImageIcon foreground =
         new ImageIcon(
             this.getClass().getResource(Config.getImagePath() + Config.getForeground()));
     g2d.drawImage(
         foreground.getImage(),
         0,
         Config.getBoardDimension().getHeight() - foreground.getIconHeight(),
         Config.getBoardDimension().getLength(),
         foreground.getIconHeight(),
         this);
   }
 }