C++Tutorial for Beginners 67 - Creating Particles (Starfields!)

preview_player
Показать описание
-------------------------------------------------------------------------------------------------------------------------------------------
In this tutorial we'll develop a class to hold our particle data and use it to draw a starfield on the screen!
--------------------------------------------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

can you explain why you made a pointer at 13:35 for the particle?? i dont get the reasoning

Coolgatty
Автор

hey john, I got this to work partly, but by the end of the tutorial my program generates the particles in a single position locked in the middle and i'm not sure why. I triple checked that my code, including the random position number generators, were the same. I'm using the netbeans IDE and the same SDL file you are so I'm not really sure what is going on. I can change the color so that instead of white the particles are red and i still get just one particle in the middle thats red, or maybe its all 5000 that are being generated there. They won't change their position. please help

____________
Автор

I'm getting the error whenever I press the *X* button on after running the program.
"SDL Basic(1625, 0x7fff7dc13300) malloc: *** error for object 0x7fe43b843a08: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug"

I'm not sure why.. I think it's the problem with the code in the deconstructor of the Swarm class, which is *delete* m_pParticles;

Idk why it say that I'm deleting a pointer that's not allocated for, which is weird because I used the *new* operator in the constructor class.

awowoosas