Skip to content
Snippets Groups Projects
Commit 5215c648 authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

corrected bug paint with rectangular cells

parent 3c486887
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,8 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
this.squareHeight = squareHeight;
this.columnCount = columnCount;
this.rowCount = rowCount;
super.setWidth(squareWidth*columnCount);
super.setHeight(squareHeight*rowCount);
}
private void paintLines(){
......@@ -88,10 +90,10 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
private void paintSquare(int row, int column, Color color){
getGraphicsContext2D().setFill(color);
getGraphicsContext2D().fillRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth);
getGraphicsContext2D().fillRect(column*squareWidth,row*squareHeight, squareWidth, squareHeight);
}
private void clearSquare(int row, int column){
getGraphicsContext2D().clearRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth);
getGraphicsContext2D().clearRect(column*squareWidth,row*squareHeight, squareWidth, squareHeight);
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@
mnemonicParsing="false" onAction="#pauseToggleButtonAction" prefHeight="24.0"
prefWidth="200.0" styleClass="button" text="Pause"/>
</VBox>
<FirefighterGrid fx:id="grid" width="1000.0" height="1000.0"
<FirefighterGrid fx:id="grid"
xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml">
</FirefighterGrid>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment