diff options
Diffstat (limited to 'src/main/java/controller/MainWindowController.java')
| -rw-r--r-- | src/main/java/controller/MainWindowController.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/main/java/controller/MainWindowController.java b/src/main/java/controller/MainWindowController.java index e92af36..36b0293 100644 --- a/src/main/java/controller/MainWindowController.java +++ b/src/main/java/controller/MainWindowController.java @@ -34,7 +34,7 @@ public class MainWindowController implements IObserver { private int squareSize=100; private int squarePadding=10; - private int[] boardPosition={40,0}; + private int[] boardPosition={30,0}; private int fontSize=60; @@ -108,10 +108,14 @@ public class MainWindowController implements IObserver { else{ this.score.setText("Score : " + this.model.getScore()); } + int[][] board=this.model.getBoard(); GraphicsContext gc = boardCanvas.getGraphicsContext2D(); gc.clearRect(0,0,500,500); - int[][] board=this.model.getBoard(); + + gc.setFill(Color.rgb(187,173,160)); + gc.fillRect(this.boardPosition[0],this.boardPosition[1], ((this.squareSize+squarePadding)*board.length)+squarePadding, ((this.squareSize+squarePadding)*board[0].length)+squarePadding); + @@ -162,14 +166,11 @@ public class MainWindowController implements IObserver { int x=this.boardPosition[0] + (j*this.squareSize); + x+=(j+1)*squarePadding; + int y=this.boardPosition[1] + (i*this.squareSize); + y+=(i+1)*squarePadding; - if(j>0){ - x+=j*squarePadding; - } - if(i>0){ - y+=i*squarePadding; - } gc.fillRect(x,y, this.squareSize, this.squareSize); @@ -194,7 +195,7 @@ public class MainWindowController implements IObserver { } gc.setFont(new Font(localFontSize)); - gc.fillText(strValue, x + (this.squareSize / 2) - ((localFontSize/3)+strValue.length()*localFontSize/5) , y + (this.squareSize / 2) + (localFontSize /3)); + gc.fillText(strValue, x + (this.squareSize / 2) - ((localFontSize/4)+strValue.length()*localFontSize/5) , y + (this.squareSize / 2) + (localFontSize /3)); } |
