package com.droidquest.devices; import java.awt.Color; import java.awt.Dimension; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import com.droidquest.Room; import com.droidquest.chipstuff.Port; import com.droidquest.items.Item; public class RoomSensor extends Device { String targetClass; Item target; Dimension d1 = new Dimension(); // Output pointing Right, Left Dimension d2 = new Dimension(); // Output pointing Up, Down public RoomSensor(int X, int Y, Room r, Item item) { x=X; y=Y; room = r; target = item; editable=true; targetClass = target.getClass().toString().substring(6); // Removes "class " rotation = 1; // Right d1.width = 32 + target.getWidth(); d1.height = Math.max(target.getHeight()+8,18); d2.width = Math.max(target.getWidth()+8,18); d2.height = 32 + target.getHeight(); width = d1.width; height = d1.height; ports = new Port[1]; ports[0] = new Port(width-2,height/2,Port.TYPE_OUTPUT,24,Port.ROT_UP,this); icons = new ImageIcon[2]; GenerateIcons(); } public void GenerateIcons() { if (ports==null) { ports = new Port[1]; ports[0] = new Port(width-2,height/2,Port.TYPE_OUTPUT,24,Port.ROT_UP,this); if (rotation > 0) { int rot = rotation; if (rotation%2==1) { int temp = width; width = height; height = temp; } rotation = 0; for (int r=0; r