This program is a simple particle simulation using the SDL2 library. It initializes a screen using SDL, creates a swarm of particles, and updates their positions and colors in a game loop until the user decides to quit.
- A C++ compiler supporting C++11 or later.
- SDL2 library installed on your system.
To build and run the program, follow the steps below:
- Navigate to the project directory.
- Run the build command (this may vary depending on your build system and platform).
- Execute the resulting binary.
g++ -std=c++11 -o ParticleSimulation main.cpp Screen.cpp Swarm.cpp Particle.cpp -lSDL2
./ParticleSimulation
main.cpp
: Contains themain
function where the program starts. It initializes the screen, handles the game loop, updates particles, and draws them to the screen.Screen.cpp
: Manages the screen initialization, updating, and event processing using SDL2.Swarm.cpp
: Manages the swarm of particles, including their updating.Particle.cpp
: Represents an individual particle and manages its properties and behavior.
Screen.h
: Header file for theScreen
class.Swarm.h
: Header file for theSwarm
class.Particle.h
: Header file for theParticle
class.
Once the program is running, it will display a swarm of particles on the screen with changing colors. The user can quit the program by closing the window.