/** * Draws the entity on the map editor. * * @param g graphic context * @param zoom zoom of the image (for example, 1: unchanged, 2: zoom of 200%) * @param showTransparency true to make transparent pixels, false to replace them by a background * color */ public void paint(Graphics g, double zoom, boolean showTransparency) { if (resizableImage == null) { resizableImage = Project.getEditorImageOrEmpty("entity_sensor_resizable.png"); } Rectangle positionInMap = getPositionInMap(); int x = (int) (positionInMap.x * zoom); int y = (int) (positionInMap.y * zoom); int w = (int) (positionInMap.width * zoom); int h = (int) (positionInMap.height * zoom); g.setColor(new Color(200, 224, 96)); g.fillRect(x, y, w, h); int dx1 = (int) ((positionInMap.x + positionInMap.width / 2 - 8) * zoom); int dy1 = (int) ((positionInMap.y + positionInMap.height / 2 - 8) * zoom); int dx2 = (int) (dx1 + 16 * zoom); int dy2 = (int) (dy1 + 16 * zoom); int sx1 = 0; int sx2 = sx1 + 32; g.drawImage(resizableImage, dx1, dy1, dx2, dy2, sx1, 0, sx2, 32, null); drawEntityOutline(g, zoom, new Color(184, 200, 96)); }