-
Notifications
You must be signed in to change notification settings - Fork 0
/
as_mediano.cpp
34 lines (28 loc) · 1.46 KB
/
as_mediano.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "as_mediano.h"
As_Mediano::As_Mediano(QVector2D posicion, QVector2D velocidad):
As_Subdivisible(posicion, velocidad)
{
QPolygon poly;
poly << QPoint(0,-10) << QPoint(6,-8) << QPoint(6,-6) << QPoint(10,0) << QPoint(6,8) << QPoint(2,8) << QPoint(0,10) << QPoint(-2,8) << QPoint(-6,8) << QPoint(-8,6) << QPoint(-8,2) << QPoint(-10,0) << QPoint(-4,-8) << QPoint(-6,-8) << QPoint(-4,-8);
this->poligono = poly;
this->colisionable.setPolyShape(poly);
this->colisionable.setPoligono( transformada.map(colisionable.getPolyShape()) );
}
As_Mediano::As_Mediano(QVector2D posicion, float velMagnitud ) :
As_Subdivisible(posicion,velMagnitud)
{
QPolygon poly;
poly << QPoint(0,-10) << QPoint(6,-8) << QPoint(6,-6) << QPoint(10,0) << QPoint(6,8) << QPoint(2,8) << QPoint(0,10) << QPoint(-2,8) << QPoint(-6,8) << QPoint(-8,6) << QPoint(-8,2) << QPoint(-10,0) << QPoint(-4,-8) << QPoint(-6,-8) << QPoint(-4,-8);
this->poligono = poly;
this->colisionable.setPolyShape(poly);
this->colisionable.setPoligono( transformada.map(colisionable.getPolyShape()) );
}
void As_Mediano::dibujar(QPainter* p)
{
p->setPen(QPen(Qt::white));
transformada = QTransform().translate(posicion.x(),posicion.y()).scale(5,5);
QPolygonF colisionableTrans = transformada.map( colisionable.getPolyShape() );
colisionable.setPoligono(colisionableTrans);
p->drawPolygon(transformada.map(poligono));
// p->drawPolygon(colisionable.getPoligono());
}