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); } }
/** Test of getLowestPointsInTable method, of class Highscore. */ @Test public void testGetLowestPointsInTable() { this.highscore = Highscore.getHighscore(PATH); LinkedList<Double> numbers = new LinkedList<>(); for (int i = 0; i < Config.getHighscoreLimit() + 4; i++) { Double rand = Math.random() * 50000; numbers.add(rand); this.highscore.addEntry(rand, "Benjamin"); if (i + 1 < Config.getHighscoreLimit()) { HighscoreTest.assertEquals(0d, this.highscore.getLowestPointsInTable()); } else { Collections.sort(numbers, Collections.reverseOrder()); Double check = numbers.get(Config.getHighscoreLimit() - 1); HighscoreTest.assertEquals(check, this.highscore.getLowestPointsInTable()); } } }
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); } }