Add static Metatile::coordFromPixmapCoord()
This commit is contained in:
parent
9565b677d2
commit
84f920bb03
2 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "tile.h"
|
||||
#include <QImage>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
|
||||
class Metatile
|
||||
|
@ -20,6 +21,7 @@ public:
|
|||
Metatile *copy();
|
||||
void copyInPlace(Metatile*);
|
||||
static int getBlockIndex(int);
|
||||
static QPoint coordFromPixmapCoord(const QPointF &pixelCoord);
|
||||
};
|
||||
|
||||
#endif // METATILE_H
|
||||
|
|
|
@ -39,3 +39,9 @@ int Metatile::getBlockIndex(int index) {
|
|||
return index - Project::getNumMetatilesPrimary();
|
||||
}
|
||||
}
|
||||
|
||||
QPoint Metatile::coordFromPixmapCoord(const QPointF &pixelCoord) {
|
||||
int x = static_cast<int>(pixelCoord.x()) / 16;
|
||||
int y = static_cast<int>(pixelCoord.y()) / 16;
|
||||
return QPoint(x, y);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue