diff --git a/Quasi-Engine.pro b/Quasi-Engine.pro index bbcd318..5be7130 100644 --- a/Quasi-Engine.pro +++ b/Quasi-Engine.pro @@ -5,3 +5,9 @@ SUBDIRS += src contains(BUILD_EXAMPLES, 1) { SUBDIRS += examples demos } +unix { + QMAKE_CXXFLAGS += -I/usr/local/include + LIBS += -L/usr/local/lib + INCLUDEPATH += -I/usr/local/include +} + diff --git a/src/polygon.cpp b/src/polygon.cpp index 9cf2c28..36b6823 100644 --- a/src/polygon.cpp +++ b/src/polygon.cpp @@ -40,7 +40,14 @@ void Polygon::updateShape(qreal penWidth) // it's own boundingRect and we have to fix it somehow. Q_UNUSED(penWidth); - b2Vec2 polygon[m_points.count()]; +/* avoid error: +Variable length array of non-POD element type 'b2Vec2' +TODO: rewrite using vectors +*/ + +// b2Vec2 polygon[m_points.count()]; + b2Vec2 *polygon = new b2Vec2[m_points.count()]; + qreal xOffset = x() - parentItem()->width() / 2.0; qreal yOffset = y() - parentItem()->height() / 2.0; @@ -58,4 +65,6 @@ void Polygon::updateShape(qreal penWidth) b2PolygonShape *polygonShape = static_cast(m_shape); polygonShape->Set(polygon, m_points.count()); + + delete [] polygon; } diff --git a/src/polyline.cpp b/src/polyline.cpp index 76025ea..cd0e4a6 100644 --- a/src/polyline.cpp +++ b/src/polyline.cpp @@ -54,7 +54,14 @@ void Polyline::updateShape(qreal penWidth) // it's own boundingRect and we have to fix it somehow. Q_UNUSED(penWidth); - b2Vec2 polyline[m_points.count()]; +/* +avoid error: +Variable length array of non-POD element type 'b2Vec2' +TODO: rewrite using vector +*/ +// b2Vec2 polyline[m_points.count()]; + b2Vec2 *polyline = new b2Vec2[m_points.count()]; + qreal xOffset = x() - parentItem()->width() / 2.0; qreal yOffset = y() - parentItem()->height() / 2.0; @@ -80,6 +87,8 @@ void Polyline::updateShape(qreal penWidth) chainShape->CreateLoop(polyline, m_points.count()); else chainShape->CreateChain(polyline, m_points.count()); + + delete [] polyline; } void Polyline::setLoop(const bool &loop) diff --git a/src/src.pro b/src/src.pro index d2833e0..072534b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -97,3 +97,9 @@ qmlpluginfiles.files += \ $$OUT_PWD/imports/QuasiGame/* INSTALLS += target qmlpluginfiles + +unix { + QMAKE_CXXFLAGS += -I/usr/local/include + LIBS += -L/usr/local/lib + INCLUDEPATH += -I/usr/local/include +}