Hello SFML-People,
I've got a problem.
I want to make a sound-visualizer.
So I wrote a shape-class which derived from sf::Shape.
I want to get something like this:
I filled my shape with 70 points. All points in one x-row and all y-value are 0. Except from the 35th.
This point the y-value I set on 100.
But what I get is this:
But what I expect and want is this:
Whats wrong?
Do you need source code?
My "MyShape"-Class:
MyShape::MyShape(const std::size_t& pointCount)
: mPointCount(pointCount)
{
mPoints.resize(pointCount);
}
MyShape::~MyShape()
{
}
std::size_t MyShape::getPointCount() const
{
return mPointCount;
}
sf::Vector2f MyShape::getPoint(std::size_t index) const
{
return mPoints[index];
}
void MyShape::setPoint(const unsigned int& index, const sf::Vector2f& point)
{
mPoints[index] = point;
}
The using:
const int convexPointCount = 70;
mMyShape = new MyShape(convexPointCount);
sf::Vector2f pointFirst(0, 0);
mMyShape->setPoint(0, pointFirst);
for (int index(1); index < convexPointCount-1; ++index)
{
sf::Vector2f point(index * 10, 0);
mMyShape->setPoint(index, point);
}
sf::Vector2f pointLast( 69 * 10, 0);
mMyShape->setPoint(69, pointLast);
mMyShape->setPoint(35, sf::Vector2f(mMyShape->getPoint(35).x,100));
I hope you understand my problem...
Best regards