Exemplo n.º 1
0
 public void addNotify() {
   super.addNotify();
   Art.init(getGraphicsConfiguration());
   levelRenderer =
       new LevelRenderer(level, getGraphicsConfiguration(), level.width * 16, level.height * 16);
   levelRenderer.renderBehaviors = true;
 }
Exemplo n.º 2
0
 public void paintComponent(Graphics g) {
   g.setColor(new Color(0x8090ff));
   g.fillRect(0, 0, level.width * 16, level.height * 16);
   levelRenderer.render(g, 0, 0);
   g.setColor(Color.BLACK);
   g.drawRect(xTile * 16 - 1, yTile * 16 - 1, 17, 17);
 }
Exemplo n.º 3
0
  public void mouseDragged(MouseEvent e) {
    xTile = e.getX() / 16;
    yTile = e.getY() / 16;

    level.setBlock(xTile, yTile, tilePicker.pickedTile);
    levelRenderer.repaint(xTile - 1, yTile - 1, 3, 3);

    repaint();
  }
Exemplo n.º 4
0
 public void setLevel(Level level) {
   this.level = level;
   Dimension size = new Dimension(level.width * 16, level.height * 16);
   setPreferredSize(size);
   setMinimumSize(size);
   setMaximumSize(size);
   repaint();
   levelRenderer.setLevel(level);
 }
Exemplo n.º 5
0
  public void mousePressed(MouseEvent e) {
    xTile = e.getX() / 16;
    yTile = e.getY() / 16;

    if (e.getButton() == 3) {
      tilePicker.setPickedTile(level.getBlock(xTile, yTile));
    } else {
      level.setBlock(xTile, yTile, tilePicker.pickedTile);
      levelRenderer.repaint(xTile - 1, yTile - 1, 3, 3);

      repaint();
    }
  }