Fixed a rendering bug. added class diagramms

This commit is contained in:
t-moe
2016-06-25 19:19:32 +02:00
parent 8a46decd3b
commit 450df5f1f9
4 changed files with 4 additions and 1 deletions

BIN
doc/cd1.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

BIN
doc/cd2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
doc/cd3.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

View File

@@ -154,9 +154,10 @@ public class FieldCanvas extends JPanel{
private Point getClickPoint(Point globalPos) {
int total = Math.min(this.getHeight()-borderTop-borderBottom,FieldCanvas.this.getWidth()-borderLeft-borderRight);
int space = total/game.getSize();
total = space*game.getSize();
globalPos.translate(-borderLeft, -borderTop);
if(globalPos.x<0 || globalPos.x >total || globalPos.y < 0 || globalPos.y > total) return null;
if(globalPos.x<0 || globalPos.x >=total || globalPos.y < 0 || globalPos.y >= total) return null;
return new Point(globalPos.x/space,globalPos.y/space);
}
@@ -220,6 +221,8 @@ public class FieldCanvas extends JPanel{
int sSpace = space/3;
int sSpace2 = space/5;
g.setColor(Color.lightGray);
g.fillRect(src.x*space+2, src.y*space+2, space -3, space -3);
g.setColor(c);
g.fillRect(src.x*space+2+sSpace2, src.y*space+2+sSpace2, space -3 - 2* sSpace2, space -3 - 2* sSpace2);