private void createImageViews() { for (int visibleX = 0; visibleX < getViewModel().getNbVisibleTilesX(); visibleX++) { for (int visibleY = 0; visibleY < getViewModel().getNbVisibleTilesY(); visibleY++) { ImageView node = spritesheet.createImageView(0); node.setLayoutX(getViewModel().visibleTileToScreenX(visibleX)); node.setLayoutY(getViewModel().visibleTileToScreenY(visibleY)); /* final int vX = visibleX; final int vY = visibleY; node.setOnMouseClicked(e -> { double screenX = getViewModel().visibleTileToScreenX(vX) + e.getX(); double screenY = getViewModel().visibleTileToScreenY(vY) + e.getY(); double worldX = getViewModel().screenToWorldX(screenX); double worldY = getViewModel().screenToWorldY(screenY); double worldZ = getViewModel().getCurrentZLevel(); //double worldZ = getViewModel().getLowestVisibleZ(vX, vY); //getUserInputHandler().worldPointClicked(worldX, worldY, worldZ, e); //e.consume(); }); */ visibleImageViews[getIndexForView(visibleX, visibleY)] = node; tilePanels[0].getChildren().add(node); showAsAnchored( visibleX, visibleY, getViewModel().getAnchorMatrix().getValueAt(visibleX, visibleY)); } } }
protected void setImageViewTile(int visibleX, int visibleY, int tileIndex) { ImageView view = getImageView(visibleX, visibleY); if (tileIndex >= 0) { view.setViewport(spritesheet.getViewport(tileIndex)); view.setVisible(true); } else { view.setVisible(false); } }