mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Shape: Convert Point to QObject / QPointF
Also add one Q_PROPERTY for each coordinate (x and y) of a Point. This will enable the controller to set and get these properties. Since QObjects cannot be copied, we also need to change the Shape class to have a vector of pointers to Points, instead of actual Point structs.
This commit is contained in:
@@ -60,19 +60,19 @@ int map_int(int value, int istart, int istop, int ostart, int ostop)
|
||||
Quad* createQuadForTexture(Texture* texture, int frameWidth, int frameHeight)
|
||||
{
|
||||
return new Quad(
|
||||
Point(texture->getX(), texture->getY()),
|
||||
Point(texture->getX() + texture->getWidth(), texture->getY()),
|
||||
Point(texture->getX() + texture->getWidth(), texture->getY() + texture->getHeight()),
|
||||
Point(texture->getX(), texture->getY() + texture->getHeight())
|
||||
new Point(qreal(texture->getX()), qreal(texture->getY())),
|
||||
new Point(qreal(texture->getX() + texture->getWidth()), qreal(texture->getY())),
|
||||
new Point(qreal(texture->getX() + texture->getWidth()), qreal(texture->getY() + texture->getHeight())),
|
||||
new Point(qreal(texture->getX()), qreal(texture->getY() + texture->getHeight()))
|
||||
);
|
||||
}
|
||||
|
||||
Triangle* createTriangleForTexture(Texture* texture, int frameWidth, int frameHeight)
|
||||
{
|
||||
return new Triangle(
|
||||
Point(texture->getX(), texture->getY()),
|
||||
Point(texture->getX() + texture->getWidth(), texture->getY()),
|
||||
Point(texture->getX() + texture->getWidth() / 2, texture->getY() + texture->getHeight())
|
||||
new Point(qreal(texture->getX()), qreal(texture->getY())),
|
||||
new Point(qreal(texture->getX() + texture->getWidth()), qreal(texture->getY())),
|
||||
new Point(qreal(texture->getX() + texture->getWidth() / 2), qreal(texture->getY() + texture->getHeight()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user