Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Quasi-Engine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

11 changes: 10 additions & 1 deletion src/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -58,4 +65,6 @@ void Polygon::updateShape(qreal penWidth)

b2PolygonShape *polygonShape = static_cast<b2PolygonShape*>(m_shape);
polygonShape->Set(polygon, m_points.count());

delete [] polygon;
}
11 changes: 10 additions & 1 deletion src/polyline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
}