2019-01-25 10:45:29 -05:00

31 lines
704 B
Java

package com.charego.freecellfx.view.pile;
import com.charego.freecellfx.model.pile.Pile;
import com.charego.freecellfx.model.Card;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class StackedPileView extends PileView {
public StackedPileView(Pile pile) {
super(pile);
}
@Override
public void paint(GraphicsContext gc, double x, double y) {
if (pile.isEmpty()) {
// draw an outline
gc.setStroke(Color.YELLOW);
gc.strokeRect(x, y, Card.width, Card.height);
} else {
// draw the top card
gc.drawImage(pile.topCard().image(), x, y);
}
if (isSelected()) {
gc.setFill(highlight);
gc.fillRect(x, y, Card.width, Card.height);
}
}
}