S
Snoeys Andy
Hello,
I have hit into a problem with my latest program that creates a little
particle engine.
The engine itself is set up out of functions in a class.
It needs little "outside" info, only the mouse positions X and Y when
it is clicked.
I have an initialisation function that receives the mouse position,
and loads it into the memory assigned for the particles.
The memory is dynamically allocated in the classes constructor.
Then I have made a function that draws the particles to the screen and
edits their position.
The problem is, the second funtion keeps "forgetting" the updated
positions of the particles. It keeps returning to the values I got
from the mouse press.
I suppose I could bypass this problem by declaring and allocating the
memory globally, and then feed it to the function as a reference. But
that feels wrong.
How do I fix this?
Thanks!
Regards,
Snoeys Andy
I have hit into a problem with my latest program that creates a little
particle engine.
The engine itself is set up out of functions in a class.
It needs little "outside" info, only the mouse positions X and Y when
it is clicked.
I have an initialisation function that receives the mouse position,
and loads it into the memory assigned for the particles.
The memory is dynamically allocated in the classes constructor.
Then I have made a function that draws the particles to the screen and
edits their position.
The problem is, the second funtion keeps "forgetting" the updated
positions of the particles. It keeps returning to the values I got
from the mouse press.
I suppose I could bypass this problem by declaring and allocating the
memory globally, and then feed it to the function as a reference. But
that feels wrong.
How do I fix this?
Thanks!
Regards,
Snoeys Andy