v0.6.2 released! Redesigned WorldMap editor. Many new UI features. Fixed

Trainer.
This commit is contained in:
Zukero
2017-05-05 15:07:50 +02:00
parent 38a1e90aad
commit e04c3ee2fd
12 changed files with 270 additions and 65 deletions

View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="src" path="hacked-libtiled"/>
<classpathentry kind="src" path="siphash-zackehh/src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jide-oss.jar"/>
<classpathentry kind="lib" path="lib/json_simple-1.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
<classpathentry kind="lib" path="lib/prefuse.jar"/>
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
<classpathentry kind="lib" path="lib/ui.jar"/>
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.3.jar"/>
<classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
<classpathentry kind="src" path="hacked-libtiled"/>
<classpathentry kind="src" path="siphash-zackehh/src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jide-oss.jar"/>
<classpathentry kind="lib" path="lib/json_simple-1.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
<classpathentry kind="lib" path="lib/prefuse.jar"/>
<classpathentry kind="lib" path="lib/rsyntaxtextarea.jar"/>
<classpathentry kind="lib" path="lib/ui.jar"/>
<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
<classpathentry kind="lib" path="lib/jsoup-1.10.2.jar" sourcepath="lib/jsoup-1.10.2-sources.jar"/>
<classpathentry kind="lib" path="lib/AndorsTrainer_v0.1.4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="ATContentStudio/ATCS_v0.6.1.jar"/>
<jar path="ATContentStudio/ATCS_v0.6.2.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>

BIN
itemScroll.xcf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,7 +1,7 @@
!include MUI2.nsh
!define VERSION "0.6.1"
!define TRAINER_VERSION "0.1.3"
!define VERSION "0.6.2"
!define TRAINER_VERSION "0.1.4"
!define JAVA_BIN "javaw"
Name "Andor's Trail Content Studio v${VERSION}"

View File

@@ -24,7 +24,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
public class ATContentStudio {
public static final String APP_NAME = "Andor's Trail Content Studio";
public static final String APP_VERSION = "v0.6.1";
public static final String APP_VERSION = "v0.6.2";
public static boolean STARTED = false;
public static StudioFrame frame = null;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -32,6 +32,8 @@ public class WorldmapSegment extends GameDataElement {
private static final long serialVersionUID = 2658610076889592723L;
public static final String TEMP_LABEL_KEY = "ATCS_INTERNAL_TEMPORARY_KEY_FOR_LABEL";
public int segmentX;
public int segmentY;
public Map<String, Point> mapLocations = new LinkedHashMap<String, Point>();
@@ -154,6 +156,7 @@ public class WorldmapSegment extends GameDataElement {
map.setAttribute("x", Integer.toString(mapLocations.get(s).x + segmentX));
map.setAttribute("y", Integer.toString(mapLocations.get(s).y + segmentY));
for (String label : labelledMaps.keySet()) {
if (TEMP_LABEL_KEY.equals(label)) continue;
if (labelledMaps.get(label).contains(s)) {
map.setAttribute("area", label);
}
@@ -161,7 +164,9 @@ public class WorldmapSegment extends GameDataElement {
element.appendChild(map);
}
for (NamedArea area : labels.values()) {
for (String key : labels.keySet()) {
if (TEMP_LABEL_KEY.equals(key)) continue;
NamedArea area = labels.get(key);
Element namedArea = doc.createElement("namedarea");
namedArea.setAttribute("id", area.id);
namedArea.setAttribute("name", area.name);

View File

@@ -227,6 +227,10 @@ public class DefaultIcons {
public static Image getCreateTileLayerImage() { return getImage(CREATE_TILE_LAYER_RES); }
public static Image getCreateTileLayerIcon() { return getIcon(CREATE_TILE_LAYER_RES); }
private static String LABEL_RES = "/com/gpl/rpg/atcontentstudio/img/label.png";
public static Image getLabelImage() { return getImage(LABEL_RES); }
public static Image getLabelIcon() { return getIcon(LABEL_RES); }
private static String ZOOM_RES = "/com/gpl/rpg/atcontentstudio/img/zoom.png";
public static Image getZoomImage() { return getImage(ZOOM_RES); }
public static Image getZoomIcon() { return getIcon(ZOOM_RES); }

View File

@@ -90,6 +90,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
ListModel<TMXMap> currentHighlightListModel = null;
JList<TMXMap> mapsShown;
JList<WorldmapSegment.NamedArea> labelList;
JTextField labelIdField;
JTextField labelNameField;
@@ -343,9 +344,6 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
// mapView.selected.add(selectedMap);
update = true;
}
if (e.getClickCount() == 2) {
ATContentStudio.frame.openEditor(worldmap.getProject().getMap(selectedMap));
}
}
} else if (editMode == EditMode.addMap && mapBeingAddedID != null) {
if (e.getButton() == MouseEvent.BUTTON1) {
@@ -440,6 +438,26 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
mapView.addMouseListener(mouseListener);
mapView.addMouseMotionListener(mouseListener);
mapView.addMapClickListener(new WorldMapView.MapClickListener() {
@Override
public void mapClicked(MouseEvent e, TMXMap m) {
if (e.getClickCount() == 2) {
ATContentStudio.frame.openEditor(m);
}
}
@Override
public void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget) {
if (e.getClickCount() == 2) {
ATContentStudio.frame.openEditor(changeTarget);
}
}
@Override
public void backgroundClicked(MouseEvent e) {
}
});
return pane;
}
@@ -496,13 +514,18 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
labelEditPane.add(new JLabel("Labels on the worldmap"), JideBoxLayout.FIX);
mslListModel = new MapSegmentLabelsListModel(worldmap);
final JList<WorldmapSegment.NamedArea> labelList = new JList<WorldmapSegment.NamedArea>(mslListModel);
labelList = new JList<WorldmapSegment.NamedArea>(mslListModel);
labelList.setCellRenderer(new MapLabelCellRenderer());
labelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
labelEditPane.add(new JScrollPane(labelList), JideBoxLayout.FLEXIBLE);
JPanel labelListButtonsPane = new JPanel();
//TODO Add the buttons
labelListButtonsPane.setLayout(new JideBoxLayout(labelListButtonsPane, JideBoxLayout.LINE_AXIS));
final JButton createLabel = new JButton(new ImageIcon(DefaultIcons.getCreateIcon()));
labelListButtonsPane.add(createLabel, JideBoxLayout.FIX);
final JButton deleteLabel = new JButton(new ImageIcon(DefaultIcons.getNullifyIcon()));
labelListButtonsPane.add(deleteLabel, JideBoxLayout.FIX);
labelListButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
labelEditPane.add(labelListButtonsPane, JideBoxLayout.FIX);
final JPanel labelParametersPane = new JPanel();
@@ -511,15 +534,39 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
labelList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (labelList.getSelectedValue() != null) {
selectedLabel = labelList.getSelectedValue();
updateLabelParamsPane(labelParametersPane, worldmap);
labelEditPane.revalidate();
labelEditPane.repaint();
}
selectedLabel = labelList.getSelectedValue();
updateLabelParamsPane(labelParametersPane, worldmap);
labelEditPane.revalidate();
labelEditPane.repaint();
}
});
createLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
WorldmapSegment.NamedArea creation = new WorldmapSegment.NamedArea(null, null, null);
worldmap.labels.put(WorldmapSegment.TEMP_LABEL_KEY, creation);
worldmap.labelledMaps.put(WorldmapSegment.TEMP_LABEL_KEY, new ArrayList<String>());
mslListModel.listChanged();
labelList.setSelectedValue(creation, true);
}
});
deleteLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (selectedLabel.id != null) {
worldmap.labelledMaps.remove(selectedLabel.id);
worldmap.labels.remove(selectedLabel.id);
} else {
worldmap.labelledMaps.remove(WorldmapSegment.TEMP_LABEL_KEY);
worldmap.labels.remove(WorldmapSegment.TEMP_LABEL_KEY);
}
labelList.clearSelection();
mslListModel.listChanged();
notifyModelModified();
}
});
tabPane.addTab("Labels", labelEditPane);
@@ -530,6 +577,10 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
private void updateLabelParamsPane(JPanel labelParametersPane, final WorldmapSegment worldmap) {
labelParametersPane.removeAll();
if (selectedLabel == null) {
setCurrentHighlightModel(null);
return;
}
labelParametersPane.setLayout(new JideBoxLayout(labelParametersPane, JideBoxLayout.PAGE_AXIS));
labelIdField = addTextField(labelParametersPane, "Internal ID: ", selectedLabel.id, worldmap.writable, this);
@@ -553,7 +604,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
});
JPanel labelCoverageButtonsPane = new JPanel();
//TODO Add the buttons.
labelCoverageButtonsPane.setLayout(new JideBoxLayout(labelCoverageButtonsPane, JideBoxLayout.LINE_AXIS));
JButton addCoverage = new JButton("Add on-map selection");
labelCoverageButtonsPane.add(addCoverage, JideBoxLayout.FIX);
JButton replaceCoverage = new JButton("Replace by on-map selection");
@@ -565,11 +616,14 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
addCoverage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (selectedLabel == null || selectedLabel.id == null) return;
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
if (selectedLabel == null) return;
String labelId = selectedLabel.id;
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
if (currentCoverage == null) {
worldmap.labelledMaps.put(selectedLabel.id, new ArrayList<String>());
currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
worldmap.labelledMaps.put(labelId, new ArrayList<String>());
currentCoverage = worldmap.labelledMaps.get(labelId);
}
for (int i = 0; i < msmListModel.getSize(); i++) {
if (msmListSelectionModel.isSelectedIndex(i)) {
@@ -586,11 +640,14 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
replaceCoverage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (selectedLabel == null || selectedLabel.id == null) return;
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
if (selectedLabel == null) return;
String labelId = selectedLabel.id;
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
if (currentCoverage == null) {
worldmap.labelledMaps.put(selectedLabel.id, new ArrayList<String>());
currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
worldmap.labelledMaps.put(labelId, new ArrayList<String>());
currentCoverage = worldmap.labelledMaps.get(labelId);
} else {
currentCoverage.clear();
}
@@ -609,16 +666,21 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
removeFromCoverage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (selectedLabel == null || selectedLabel.id == null) return;
List<String> currentCoverage = worldmap.labelledMaps.get(selectedLabel.id);
if (selectedLabel == null) return;
String labelId = selectedLabel.id;
if (labelId == null) labelId = WorldmapSegment.TEMP_LABEL_KEY;
List<String> currentCoverage = worldmap.labelledMaps.get(labelId);
if (currentCoverage == null) return;
List<String> toRemove = new ArrayList<String>();
for (int i = 0; i < mslmListModel.getSize(); i++) {
if (mslmListSelectionModel.isSelectedIndex(i)) {
if (currentCoverage.contains(mslmListModel.getElementAt(i).id)) {
currentCoverage.remove(mslmListModel.getElementAt(i).id);
toRemove.add(mslmListModel.getElementAt(i).id);
}
}
}
currentCoverage.removeAll(toRemove);
mslmListModel.listChanged();
repaintMap();
}
@@ -679,11 +741,13 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
@Override
public int getSize() {
if (area.id == null) return segment.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY).size();
return segment.labelledMaps.get(area.id).size();
}
@Override
public TMXMap getElementAt(int index) {
if (area.id == null) return segment.getProject().getMap(segment.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY).get(index));
return segment.getProject().getMap(segment.labelledMaps.get(area.id).get(index));
}
@@ -790,7 +854,13 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
label.setText("None");
} else {
WorldmapSegment.NamedArea area = (WorldmapSegment.NamedArea) value;
label.setText(area.name+" ("+area.id+")");
if (area.id != null) {
label.setText(area.name+" ("+area.id+")");
label.setIcon(new ImageIcon(DefaultIcons.getLabelIcon()));
} else {
label.setText("Incomplete Label. Enter an ID.");
label.setIcon(new ImageIcon(DefaultIcons.getNullifyIcon()));
}
}
return label;
}
@@ -1012,12 +1082,20 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener {
WorldmapSegment worldmap = (WorldmapSegment)target;
boolean changed = false;
if (source == labelIdField) {
List<String> coverage = worldmap.labelledMaps.get(selectedLabel.id);
worldmap.labelledMaps.remove(selectedLabel.id);
worldmap.labels.remove(selectedLabel.id);
List<String> coverage;
if (selectedLabel.id != null) {
coverage = worldmap.labelledMaps.get(selectedLabel.id);
worldmap.labelledMaps.remove(selectedLabel.id);
worldmap.labels.remove(selectedLabel.id);
} else {
coverage = worldmap.labelledMaps.get(WorldmapSegment.TEMP_LABEL_KEY);
worldmap.labels.remove(WorldmapSegment.TEMP_LABEL_KEY);
}
selectedLabel.id = (String) value;
worldmap.labelledMaps.put(selectedLabel.id, coverage);
worldmap.labels.put(selectedLabel.id, selectedLabel);
if (value != null) {
worldmap.labelledMaps.put(selectedLabel.id, coverage);
worldmap.labels.put(selectedLabel.id, selectedLabel);
}
mslListModel.listChanged();
changed = true;
} else if (source == labelNameField) {

View File

@@ -7,6 +7,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
@@ -29,11 +30,15 @@ import javax.swing.JComponent;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.Scrollable;
import javax.swing.ToolTipManager;
import tiled.view.MapRenderer;
import tiled.view.OrthogonalRenderer;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.maps.MapChange;
import com.gpl.rpg.atcontentstudio.model.maps.MapObject;
import com.gpl.rpg.atcontentstudio.model.maps.MapObjectGroup;
import com.gpl.rpg.atcontentstudio.model.maps.TMXMap;
import com.gpl.rpg.atcontentstudio.model.maps.WorldmapSegment;
@@ -91,12 +96,82 @@ public class WorldMapView extends JComponent implements Scrollable {
}
}
if (selectedMap != null) {
mapClicked(e, WorldMapView.this.worldmap.getProject().getMap(selectedMap));
x = x - mapLocations.get(selectedMap).x;
y = y - mapLocations.get(selectedMap).y;
//Look for a mapchange there
TMXMap map = proj.getMap(selectedMap);
boolean mapchangeFound = false;
for (MapObjectGroup group : map.groups) {
for (MapObject obj : group.mapObjects) {
if (obj instanceof MapChange) {
if (x >= obj.x && x < obj.x + obj.w && y >= obj.y && y < obj.y + obj.h) {
String mapId = ((MapChange)obj).map != null ? ((MapChange)obj).map.id : ((MapChange)obj).map_id;
mapChangeClicked(e, proj.getMap(selectedMap), proj.getMap(mapId));
mapchangeFound = true;
}
}
}
}
if (!mapchangeFound) {
mapClicked(e, WorldMapView.this.worldmap.getProject().getMap(selectedMap));
}
} else {
backgroundClicked(e);
}
}
});
addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
String selectedMap = null;
int x = (int) (e.getX() / zoomLevel);
int y = (int) (e.getY() / zoomLevel);
for (String s : mapLocations.keySet()) {
if (mapLocations.get(s).contains(x, y)) {
selectedMap = s;
break;
}
}
if (selectedMap != null) {
//Reuse x,y to indicate to tile-within-the-map coordinates.
x = x - mapLocations.get(selectedMap).x;
y = y - mapLocations.get(selectedMap).y;
//Look for a mapchange there
TMXMap map = proj.getMap(selectedMap);
boolean mapchangeFound = false;
for (MapObjectGroup group : map.groups) {
for (MapObject obj : group.mapObjects) {
if (obj instanceof MapChange) {
if (x >= obj.x && x < obj.x + obj.w && y >= obj.y && y < obj.y + obj.h) {
String mapId = ((MapChange)obj).map != null ? ((MapChange)obj).map.id : ((MapChange)obj).map_id;
setToolTipText(selectedMap+"->"+mapId);
mapchangeFound = true;
}
}
}
}
if (!mapchangeFound) {
setToolTipText(selectedMap);
}
ToolTipManager.sharedInstance().registerComponent(WorldMapView.this);
ToolTipManager.sharedInstance().setEnabled(true);
} else {
ToolTipManager.sharedInstance().setEnabled(false);
ToolTipManager.sharedInstance().unregisterComponent(WorldMapView.this);
setToolTipText(null);
}
}
});
}
@Override
public Point getToolTipLocation(MouseEvent event) {
return event.getPoint();
}
private void paintOnGraphics(Graphics2D g2) {
@@ -133,8 +208,8 @@ public class WorldMapView extends JComponent implements Scrollable {
if (layer instanceof tiled.core.TileLayer && layer.isVisible()) {
if (layer.getName().equalsIgnoreCase("walkable")) continue;
renderer.paintTileLayer(g2, (tiled.core.TileLayer) layer);
} else if (layer instanceof tiled.core.ObjectGroup && layer.isVisible()) {
// paintObjectGroup(g2, map, (tiled.core.ObjectGroup) layer);
} else if (layer instanceof tiled.core.ObjectGroup) {
paintObjectGroup(g2, map, (tiled.core.ObjectGroup) layer);
}
}
if (map.colorFilter != null) {
@@ -165,20 +240,58 @@ public class WorldMapView extends JComponent implements Scrollable {
for (String s : worldmap.labels.keySet()) {
String label = worldmap.labels.get(s).name;
Rectangle areaCovered = new Rectangle(0, 0, -1, -1);
for (String map : worldmap.labelledMaps.get(s)) {
areaCovered.add(mapLocations.get(map));
if (label != null) {
Rectangle areaCovered = new Rectangle(0, 0, -1, -1);
for (String map : worldmap.labelledMaps.get(s)) {
areaCovered.add(mapLocations.get(map));
}
Rectangle2D stringBounds = fm.getStringBounds(label, g2);
GlyphVector gv = areaNameFont.createGlyphVector(frc, label);
g2.setColor(Color.WHITE);
g2.fill(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
g2.setColor(Color.BLACK);
g2.draw(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
}
Rectangle2D stringBounds = fm.getStringBounds(label, g2);
GlyphVector gv = areaNameFont.createGlyphVector(frc, label);
g2.setColor(Color.WHITE);
g2.fill(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
g2.setColor(Color.BLACK);
g2.draw(gv.getOutline((int)(areaCovered.getCenterX() - stringBounds.getCenterX()), (int)(areaCovered.getCenterY() - stringBounds.getCenterY())));
}
}
private void paintObjectGroup(Graphics2D g2d, TMXMap map, tiled.core.ObjectGroup layer) {
for (MapObjectGroup group : map.groups) {
if (group.tmxGroup == layer) {
for (MapObject object : group.mapObjects) {
if (object instanceof MapChange) {
// Only show mapchange areas pointing to maps not shown in this worldmap
if (((MapChange)object).map != null && !mapLocations.containsKey(((MapChange)object).map.id)) {
drawObject(object, g2d, new Color(20, 20, 190));
}
}
}
break;
}
}
}
private void drawObject(MapObject object, Graphics2D g2d, Color color) {
g2d.setPaint(color);
g2d.drawRect(object.x+1, object.y+1, object.w-3, object.h-3);
g2d.drawRect(object.x+2, object.y+2, object.w-5, object.h-5);
g2d.setPaint(color.darker().darker());
g2d.drawLine(object.x, object.y + object.h - 1, object.x + object.w - 1, object.y + object.h - 1);
g2d.drawLine(object.x + object.w - 1, object.y, object.x + object.w - 1, object.y + object.h - 1);
g2d.drawLine(object.x + 3, object.y + 3, object.x + object.w - 4, object.y + 3);
g2d.drawLine(object.x + 3, object.y + 3, object.x + 3, object.y + object.h - 4);
g2d.setPaint(color.brighter().brighter().brighter());
g2d.drawLine(object.x, object.y, object.x + object.w - 1, object.y);
g2d.drawLine(object.x, object.y, object.x, object.y + object.h - 1);
g2d.drawLine(object.x + 3, object.y + object.h - 4, object.x + object.w - 4, object.y + object.h - 4);
g2d.drawLine(object.x + object.w - 4, object.y + 3, object.x + object.w - 4, object.y + object.h - 4);
Image img = object.getIcon();
g2d.setColor(new Color(255, 255, 255, 120));
g2d.fillRect(object.x + 2, object.y + 2, img.getWidth(null), img.getHeight(null));
g2d.drawImage(object.getIcon(), object.x + 2, object.y + 2, null);
}
private void outlineFromListModel(Graphics2D g2, ListModel<TMXMap> listModel, ListSelectionModel selectionModel, Color outlineColor, Stroke outlineStroke, Font mapIdFont, int mapIdLabelHeight) {
for (int i =0; i<listModel.getSize(); i++) {
//No selection model ? We want to highlight the whole list.
@@ -235,6 +348,7 @@ public class WorldMapView extends JComponent implements Scrollable {
public interface MapClickListener {
public void mapClicked(MouseEvent e, TMXMap m);
public void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget);
public void backgroundClicked(MouseEvent e);
}
@@ -252,6 +366,10 @@ public class WorldMapView extends JComponent implements Scrollable {
for (MapClickListener l : listeners) l.mapClicked(e, m);
}
private void mapChangeClicked(MouseEvent e, TMXMap m, TMXMap changeTarget) {
for (MapClickListener l : listeners) l.mapChangeClicked(e, m, changeTarget);
}
private void backgroundClicked(MouseEvent e) {
for (MapClickListener l : listeners) l.backgroundClicked(e);
}