mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
Fixed missing attributes in TMX file loading and writing (sizes in
tilesets). Added a fancy logo in the workspace selector... could look better though.
This commit is contained in:
@@ -74,6 +74,7 @@ public class TileSet implements Iterable<Tile>
|
||||
private Color transparentColor;
|
||||
private Image tileSetImage;
|
||||
public Spritesheet sheet = null;
|
||||
public Rectangle sheetDimensions;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -120,8 +121,10 @@ public class TileSet implements Iterable<Tile>
|
||||
importTileBitmap(buffered, cutter);
|
||||
}
|
||||
|
||||
public void loadFromProject(String name, TMXMap tmxMap) {
|
||||
public void loadFromProject(String name, TMXMap tmxMap, int tileWidth, int tileHeight) {
|
||||
sheet = tmxMap.getProject().getSpritesheet(name);
|
||||
tileDimensions.width = tileWidth;
|
||||
tileDimensions.height = tileHeight;
|
||||
int i = 0;
|
||||
Image tileImage = sheet.getImage(i);
|
||||
while (tileImage != null) {
|
||||
|
||||
@@ -30,6 +30,7 @@ package tiled.io;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -382,7 +383,10 @@ public class TMXMapReader
|
||||
// case.
|
||||
|
||||
if (tmxMap.getProject().getSpritesheet(name) != null) {
|
||||
set.loadFromProject(name, tmxMap);
|
||||
set.loadFromProject(name, tmxMap, tileWidth, tileHeight);
|
||||
set.sheetDimensions = new Rectangle();
|
||||
set.sheetDimensions.width = getAttribute(child, "width", 0);
|
||||
set.sheetDimensions.height = getAttribute(child, "height", 0);
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
@@ -257,7 +257,11 @@ public class TMXMapWriter
|
||||
if (tileBitmapFile != null) {
|
||||
w.startElement("image");
|
||||
w.writeAttribute("source", getRelativePath(wp, tileBitmapFile));
|
||||
|
||||
if (set.sheetDimensions != null) {
|
||||
w.writeAttribute("width", set.sheetDimensions.width);
|
||||
w.writeAttribute("height", set.sheetDimensions.height);
|
||||
}
|
||||
|
||||
Color trans = set.getTransparentColor();
|
||||
if (trans != null) {
|
||||
w.writeAttribute("trans", Integer.toHexString(
|
||||
|
||||
@@ -6,9 +6,12 @@ import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
@@ -108,9 +111,15 @@ public class WorkspaceSelector extends JFrame {
|
||||
//Layout, labels and dialog behavior.
|
||||
setTitle("Select your workspace");
|
||||
|
||||
JLabel logoLabel = new JLabel();
|
||||
try {
|
||||
logoLabel = new JLabel(new ImageIcon(ImageIO.read(WorkspaceSelector.class.getResource("/com/gpl/rpg/atcontentstudio/img/atcs_logo_banner.png"))), JLabel.CENTER);
|
||||
} catch (IOException e1) {}
|
||||
|
||||
JPanel dialogPane = new JPanel();
|
||||
dialogPane.setLayout(new BorderLayout());
|
||||
|
||||
dialogPane.add(logoLabel, BorderLayout.NORTH);
|
||||
dialogPane.add(new JLabel("Workspace : "), BorderLayout.WEST);
|
||||
dialogPane.add(combo, BorderLayout.CENTER);
|
||||
dialogPane.add(browse, BorderLayout.EAST);
|
||||
|
||||
Reference in New Issue
Block a user