Commit 157d413d42b12d98acf053f50f762caf5830ae69
- Diff rendering mode:
- inline
- side by side
src/libtiled/tileset.cpp
(2 / 0)
|   | |||
| 78 | 78 | ++tileNum; | |
| 79 | 79 | } | |
| 80 | 80 | ||
| 81 | mImageWidth = image.width(); | ||
| 82 | mImageHeight = image.height(); | ||
| 81 | 83 | mColumnCount = (image.width() - mMargin * 2 + mTileSpacing) | |
| 82 | 84 | / (mTileWidth + mTileSpacing); | |
| 83 | 85 | mImageSource = fileName; |
src/libtiled/tileset.h
(14 / 0)
|   | |||
| 57 | 57 | mTileHeight(tileHeight), | |
| 58 | 58 | mTileSpacing(tileSpacing), | |
| 59 | 59 | mMargin(margin), | |
| 60 | mImageWidth(0), | ||
| 61 | mImageHeight(0), | ||
| 60 | 62 | mColumnCount(0) | |
| 61 | 63 | { | |
| 62 | 64 | } | |
| … | … | ||
| 130 | 130 | int columnCount() const { return mColumnCount; } | |
| 131 | 131 | ||
| 132 | 132 | /** | |
| 133 | * Returns the width of the tileset image. | ||
| 134 | */ | ||
| 135 | int imageWidth() const { return mImageWidth; } | ||
| 136 | |||
| 137 | /** | ||
| 138 | * Returns the height of the tileset image. | ||
| 139 | */ | ||
| 140 | int imageHeight() const { return mImageHeight; } | ||
| 141 | |||
| 142 | /** | ||
| 133 | 143 | * Returns the transparent color, or an invalid color if no transparent | |
| 134 | 144 | * color is used. | |
| 135 | 145 | */ | |
| … | … | ||
| 182 | 182 | int mTileHeight; | |
| 183 | 183 | int mTileSpacing; | |
| 184 | 184 | int mMargin; | |
| 185 | int mImageWidth; | ||
| 186 | int mImageHeight; | ||
| 185 | 187 | int mColumnCount; | |
| 186 | 188 | QList<Tile*> mTiles; | |
| 187 | 189 | }; |
src/tiled/tmxmapwriter.cpp
(7 / 0)
|   | |||
| 221 | 221 | if (transColor.isValid()) | |
| 222 | 222 | w.writeAttribute(QLatin1String("trans"), transColor.name().mid(1)); | |
| 223 | 223 | ||
| 224 | if (tileset->imageWidth() > 0) | ||
| 225 | w.writeAttribute(QLatin1String("width"), | ||
| 226 | QString::number(tileset->imageWidth())); | ||
| 227 | if (tileset->imageHeight() > 0) | ||
| 228 | w.writeAttribute(QLatin1String("height"), | ||
| 229 | QString::number(tileset->imageHeight())); | ||
| 230 | |||
| 224 | 231 | w.writeEndElement(); | |
| 225 | 232 | } | |
| 226 | 233 |

