mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 08:55:37 -05:00
More usage of Tile/Metatile size constants
This commit is contained in:
@@ -51,10 +51,12 @@ public:
|
||||
void setLayoutId(const QString &layoutId) { m_layoutId = layoutId; }
|
||||
QString layoutId() const { return layout() ? layout()->id : m_layoutId; }
|
||||
|
||||
int getWidth() const;
|
||||
int getHeight() const;
|
||||
int getBorderWidth() const;
|
||||
int getBorderHeight() const;
|
||||
int getWidth() const { return m_layout ? m_layout->getWidth() : 0; }
|
||||
int getHeight() const { return m_layout ? m_layout->getHeight() : 0; }
|
||||
int getBorderWidth() const { return m_layout ? m_layout->getBorderWidth() : 0; }
|
||||
int getBorderHeight() const { return m_layout ? m_layout->getBorderHeight() : 0; }
|
||||
int pixelWidth() const { return m_layout ? m_layout->pixelWidth() : 0; }
|
||||
int pixelHeight() const { return m_layout ? m_layout->pixelHeight() : 0; }
|
||||
|
||||
void setHeader(const MapHeader &header) { *m_header = header; }
|
||||
MapHeader* header() const { return m_header; }
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
MapConnection* createMirror();
|
||||
|
||||
QPixmap render() const;
|
||||
QPoint relativePos(bool clipped = false) const;
|
||||
QPoint relativePixelPos(bool clipped = false) const;
|
||||
|
||||
static QPointer<Project> project;
|
||||
static const QMap<QString, QString> oppositeDirections;
|
||||
|
||||
@@ -32,6 +32,9 @@ public:
|
||||
int height;
|
||||
int border_width;
|
||||
int border_height;
|
||||
int pixelWidth() const { return this->width * Metatile::pixelWidth(); }
|
||||
int pixelHeight() const { return this->height * Metatile::pixelHeight(); }
|
||||
QSize pixelSize() const { return QSize(pixelWidth(), pixelHeight()); }
|
||||
|
||||
QString border_path;
|
||||
QString blockdata_path;
|
||||
@@ -153,7 +156,7 @@ public:
|
||||
void _floodFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
void magicFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
|
||||
QPixmap render(bool ignoreCache = false, Layout *fromLayout = nullptr, QRect bounds = QRect(0, 0, -1, -1));
|
||||
QPixmap render(bool ignoreCache = false, Layout *fromLayout = nullptr, const QRect &bounds = QRect(0, 0, -1, -1));
|
||||
QPixmap renderCollision(bool ignoreCache);
|
||||
// QPixmap renderConnection(MapConnection, Layout *);
|
||||
QPixmap renderBorder(bool ignoreCache = false);
|
||||
|
||||
@@ -64,12 +64,12 @@ public:
|
||||
static QString getMetatileIdStrings(const QList<uint16_t> metatileIds);
|
||||
static QString getLayerName(int layerNum);
|
||||
|
||||
static int tileWidth() { return 2; }
|
||||
static int tileHeight() { return 2; }
|
||||
static int tilesPerLayer() { return Metatile::tileWidth() * Metatile::tileHeight(); }
|
||||
static int pixelWidth() { return Metatile::tileWidth() * Tile::pixelWidth(); }
|
||||
static int pixelHeight() { return Metatile::tileHeight() * Tile::pixelHeight(); }
|
||||
static QSize pixelSize() { return QSize(pixelWidth(), pixelHeight()); }
|
||||
static constexpr int tileWidth() { return 2; }
|
||||
static constexpr int tileHeight() { return 2; }
|
||||
static constexpr int tilesPerLayer() { return Metatile::tileWidth() * Metatile::tileHeight(); }
|
||||
static constexpr int pixelWidth() { return Metatile::tileWidth() * Tile::pixelWidth(); }
|
||||
static constexpr int pixelHeight() { return Metatile::tileHeight() * Tile::pixelHeight(); }
|
||||
static constexpr QSize pixelSize() { return QSize(pixelWidth(), pixelHeight()); }
|
||||
|
||||
inline bool operator==(const Metatile &other) {
|
||||
return this->tiles == other.tiles && this->attributes == other.attributes;
|
||||
|
||||
@@ -26,9 +26,9 @@ public:
|
||||
|
||||
static const uint16_t maxValue;
|
||||
|
||||
static int pixelWidth() { return 8; }
|
||||
static int pixelHeight() { return 8; }
|
||||
static QSize pixelSize() { return QSize(Tile::pixelWidth(), Tile::pixelHeight()); }
|
||||
static constexpr int pixelWidth() { return 8; }
|
||||
static constexpr int pixelHeight() { return 8; }
|
||||
static constexpr QSize pixelSize() { return QSize(Tile::pixelWidth(), Tile::pixelHeight()); }
|
||||
};
|
||||
|
||||
inline bool operator==(const Tile &a, const Tile &b) {
|
||||
|
||||
Reference in New Issue
Block a user