Particle Class unable to pass data to Particle System Class

Hi, I’m trying to create multiple particle systems using a basic particle system.

The program doesn’t seem to pass the particle’s display and update function to the particle system class.

Not sure why it won’t pass the data through…here’s my code!

not sure if it is the solution… but maybe put update and display in separate function. Also if the particle system became bigger maybe better to use pointers ( i suppose you are using vector of particle, right?, because we don’t see all the code…).

I tried using separate functions but that doesn’t work, yeah I’m using vector of a particle.

Where do you recon I should I add the pointers?

look at this example, it helped me, for a similar problem. It use the ofBox2d addon (you can adapt easily to your own) but use the class Data as pointer look that. In this example, you set the velocity of the CustomParticle with function by ofBox2d instance. Sure you will create a display() (or draw() as you want) and update() method (to update velocity and position) in the pointer (your Particle class or in the example the CustomParticle class) . After you create a

vector< ofPtr<Particle>> particles

with which you manage your system particle.
I don’t know if i’m enough clear. I think some code to explain is better…

I’m still trying to get my head around pointers.

I’ve added a ptr to the particles class however it doesn’t seem to think it’s being declared even though the particle class is being included at the top.

Fixed the problem!!!

Added a pointer to the particle system in the test.h file. woo!!

Thanks for your help, was that what you meant?


Nice! yes, something like that, but strange that you have that issue with ofPtr… i would look better at your code, but it make difficult to me with the sceenshots.
Can you use another time the blockQuote instead to post the picture of the code? it is a bit difficult to read the code.
Mark also the topic as solved, please.