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
1 merge request!2Simple
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -69,6 +69,8 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{ ...@@ -69,6 +69,8 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
this.squareHeight = squareHeight; this.squareHeight = squareHeight;
this.columnCount = columnCount; this.columnCount = columnCount;
this.rowCount = rowCount; this.rowCount = rowCount;
super.setWidth(squareWidth*columnCount);
super.setHeight(squareHeight*rowCount);
} }
private void paintLines(){ private void paintLines(){
...@@ -88,10 +90,10 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{ ...@@ -88,10 +90,10 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
private void paintSquare(int row, int column, Color color){ private void paintSquare(int row, int column, Color color){
getGraphicsContext2D().setFill(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){ 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 @@ ...@@ -33,7 +33,7 @@
mnemonicParsing="false" onAction="#pauseToggleButtonAction" prefHeight="24.0" mnemonicParsing="false" onAction="#pauseToggleButtonAction" prefHeight="24.0"
prefWidth="200.0" styleClass="button" text="Pause"/> prefWidth="200.0" styleClass="button" text="Pause"/>
</VBox> </VBox>
<FirefighterGrid fx:id="grid" width="1000.0" height="1000.0" <FirefighterGrid fx:id="grid"
xmlns="http://javafx.com/javafx" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
</FirefighterGrid> </FirefighterGrid>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment