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

renaming square

parent 5215c648
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,8 @@ public class SimulatorApplication extends javafx.application.Application {
private static final String APP_NAME = "Firefighter simulator";
private static final int ROW_COUNT = 20;
private static final int COLUMN_COUNT = 20;
private static final int SQUARE_WIDTH = 50;
private static final int SQUARE_HEIGHT = 50;
private static final int BOX_WIDTH = 50;
private static final int BOX_HEIGHT = 50;
public static final int INITIAL_FIRE_COUNT = 3;
public static final int INITIAL_FIREFIGHTER_COUNT = 6;
......@@ -43,7 +43,7 @@ public class SimulatorApplication extends javafx.application.Application {
loader.setLocation(location);
view = loader.load();
Controller controller = loader.getController();
controller.initialize(SQUARE_WIDTH, SQUARE_HEIGHT, COLUMN_COUNT, ROW_COUNT,
controller.initialize(BOX_WIDTH, BOX_HEIGHT, COLUMN_COUNT, ROW_COUNT,
INITIAL_FIRE_COUNT, INITIAL_FIREFIGHTER_COUNT);
}
......
......@@ -10,10 +10,10 @@ import java.util.List;
public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
private void paintElementAtPosition(ViewElement element, Position position) {
paintSquare(position.row(), position.column(), element.color);
paintBox(position.row(), position.column(), element.color);
}
private int squareWidth;
private int squareHeight;
private int boxWidth;
private int boxHeight;
private int columnCount;
private int rowCount;
......@@ -27,7 +27,7 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
private void clear(List<Pair<Position, ViewElement>> positionedElements) {
for (Pair<Position, ViewElement> positionElement : positionedElements) {
Position position = positionElement.getKey();
clearSquare(position.row(), position.column());
clearBox(position.row(), position.column());
}
}
......@@ -64,13 +64,13 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
}
@Override
public void setDimensions(int columnCount, int rowCount, int squareWidth, int squareHeight) {
this.squareWidth = squareWidth;
this.squareHeight = squareHeight;
public void setDimensions(int columnCount, int rowCount, int boxWidth, int boxHeight) {
this.boxWidth = boxWidth;
this.boxHeight = boxHeight;
this.columnCount = columnCount;
this.rowCount = rowCount;
super.setWidth(squareWidth*columnCount);
super.setHeight(squareHeight*rowCount);
super.setWidth(boxWidth * columnCount);
super.setHeight(boxHeight * rowCount);
}
private void paintLines(){
......@@ -80,20 +80,20 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
private void paintVerticalLines() {
for(int column = 0; column < columnCount; column++)
getGraphicsContext2D().strokeLine(column*squareWidth, 0,column*squareWidth, getHeight());
getGraphicsContext2D().strokeLine(column * boxWidth, 0,column * boxWidth, getHeight());
}
private void paintHorizontalLines() {
for(int row = 0; row < rowCount; row++)
getGraphicsContext2D().strokeLine(0, row*squareHeight, getWidth(), row*squareHeight);
getGraphicsContext2D().strokeLine(0, row * boxHeight, getWidth(), row * boxHeight);
}
private void paintSquare(int row, int column, Color color){
private void paintBox(int row, int column, Color color){
getGraphicsContext2D().setFill(color);
getGraphicsContext2D().fillRect(column*squareWidth,row*squareHeight, squareWidth, squareHeight);
getGraphicsContext2D().fillRect(column * boxWidth,row * boxHeight, boxWidth, boxHeight);
}
private void clearSquare(int row, int column){
getGraphicsContext2D().clearRect(column*squareWidth,row*squareHeight, squareWidth, squareHeight);
private void clearBox(int row, int column){
getGraphicsContext2D().clearRect(column * boxWidth,row * boxHeight, boxWidth, boxHeight);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment