porymap/src/core/metatile.cpp

25 lines
562 B
C++
Raw Normal View History

2018-09-25 01:12:29 +01:00
#include "metatile.h"
#include "tileset.h"
#include "project.h"
2021-02-16 17:14:27 +00:00
Metatile::Metatile() :
behavior(0),
layerType(0),
encounterType(0),
terrainType(0)
{ }
int Metatile::getBlockIndex(int index) {
if (index < Project::getNumMetatilesPrimary()) {
return index;
} else {
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);
}