Dan Dan
Dan Dan

Reputation: 135

VertexArray can't find its vertices functions ( SFML)

I'm making a simple, gravity based particle system, so I made three classes:

Actually, I'm stuck with ParticleSystem update function here's the code:

ParticleSystem()
{
    particles.setPrimitiveType(PrimitiveType::Points);
    int indexX = 0, indexY = 0;
    for (int i = 1; i < CHUNK_SIZE; i++)
    {
        Particle particle;
        particle.position = Vector2f(indexX, indexY);
        particles.append(particle);
        if (indexX < 100)
            indexX++;
        else
        {
            indexX = 0;
            indexY++;
        }
        force.push_back(0);
    }
}
void Update()
{
    for (int i = 0; i < particles.getVertexCount(); i++)
    {
        particles[i].Update();
    }
}

The compiler gives an error when calling particles[i].Update(), because VertexArray can contain just sf::Vertex;

Any suggestion for implementing that function?

Upvotes: 0

Views: 96

Answers (1)

Ivan Rubinson
Ivan Rubinson

Reputation: 3329

Make your own vector.

std::vector<Particle> particles;

Upvotes: 0

Related Questions