Adjust positioning, identify bounds of box.

concurrentModificationException1
sigonasr2, Sig, Sigo 3 years ago
parent 6642e2074c
commit 092958d7ab
  1. BIN
      Meteo_Engine.jar
  2. 2
      src/sig/Block.java
  3. 2
      src/sig/BlockClump.java
  4. 4
      src/sig/Board.java

Binary file not shown.

@ -23,6 +23,6 @@ public class Block{
} }
public void draw(Graphics g, double x, double y, int block_width, int block_height) { public void draw(Graphics g, double x, double y, int block_width, int block_height) {
g.setColor(state.getCol()); g.setColor(state.getCol());
g.fill3DRect((int)x+this.x*block_width,(int)y+this.y*block_height, block_width, block_height, true); g.fill3DRect((int)x+this.x*block_width,(int)y-this.y*block_height, block_width, block_height, true);
} }
} }

@ -19,7 +19,7 @@ public class BlockClump {
} }
public void drawBlocks(Graphics g, int originX, int originY, int block_width, int block_height) { public void drawBlocks(Graphics g, int originX, int originY, int block_width, int block_height) {
for (Block b : blocks) { for (Block b : blocks) {
b.draw(g,originX-x*block_width,originY-y*block_height,block_width,block_height); b.draw(g,originX+x*block_width,originY-y*block_height,block_width,block_height);
} }
} }
} }

@ -1,6 +1,7 @@
package sig; package sig;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,9 +45,12 @@ public class Board {
public void drawBoard(Graphics g) { public void drawBoard(Graphics g) {
final int DRAW_STARTX = (int)(x - block_width*((double)width/2)); final int DRAW_STARTX = (int)(x - block_width*((double)width/2));
final int DRAW_STARTY = (int)(y + block_height*((double)height/2)); final int DRAW_STARTY = (int)(y + block_height*((double)height/2));
final int DRAW_ENDX = (int)(x + block_width*((double)width/2));
for (BlockClump bc : blockData) { for (BlockClump bc : blockData) {
bc.drawBlocks(g,DRAW_STARTX,DRAW_STARTY,block_width,block_height); bc.drawBlocks(g,DRAW_STARTX,DRAW_STARTY,block_width,block_height);
} }
g.setColor(Color.BLACK);
g.fillRoundRect(DRAW_STARTX, DRAW_STARTY+block_height, DRAW_ENDX-DRAW_STARTX, 3, 3, 1);
} }
} }

Loading…
Cancel
Save