コード例 #1
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();
  }
コード例 #2
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();
    }
  }