android port: convert use of java.awt.Rectangle to own CityRect class

java.awt.Rectangle does not exist in the android SDK, so this patch
replaces its use within the Micropolis engine code with a custom class
with equivalent functionality.

This way all the classes in micropolisj.engine can be compiled with
the subset of the Java SDK that also exists in the Android SDK.

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@853 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-09-09 14:11:55 +00:00
parent 6b899d096d
commit 7b68e1299d
7 changed files with 70 additions and 20 deletions

View file

@ -1265,7 +1265,7 @@ public class MainWindow extends JFrame
if (h >= 3)
y--;
drawingArea.setToolCursor(new Rectangle(x,y,w,h), currentTool);
drawingArea.setToolCursor(new CityRect(x,y,w,h), currentTool);
}
private void onToolExited(MouseEvent ev)

View file

@ -243,12 +243,12 @@ public class MicropolisDrawingArea extends JComponent
static class ToolCursor
{
Rectangle rect;
CityRect rect;
Color borderColor;
Color fillColor;
}
public void setToolCursor(Rectangle newRect, MicropolisTool tool)
public void setToolCursor(CityRect newRect, MicropolisTool tool)
{
ToolCursor tp = new ToolCursor();
tp.rect = newRect;
@ -292,7 +292,7 @@ public class MicropolisDrawingArea extends JComponent
public void setToolPreview(ToolPreview newPreview)
{
if (toolPreview != null) {
Rectangle b = toolPreview.getBounds();
CityRect b = toolPreview.getBounds();
Rectangle r = new Rectangle(
b.x*TILE_WIDTH,
b.y*TILE_HEIGHT,
@ -305,7 +305,7 @@ public class MicropolisDrawingArea extends JComponent
toolPreview = newPreview;
if (toolPreview != null) {
Rectangle b = toolPreview.getBounds();
CityRect b = toolPreview.getBounds();
Rectangle r = new Rectangle(
b.x*TILE_WIDTH,
b.y*TILE_HEIGHT,