Particle fountain: Difference between revisions

Content added Content deleted
(Added C++ solution)
m (C++ - removed unnecessary variable)
Line 100: Line 100:
int width_;
int width_;
int height_;
int height_;
int particles_;
std::vector<PointInfo> point_info_;
std::vector<PointInfo> point_info_;
std::vector<SDL_Point> points_;
std::vector<SDL_Point> points_;
Line 113: Line 112:


ParticleFountain::ParticleFountain(int n, int width, int height)
ParticleFountain::ParticleFountain(int n, int width, int height)
: width_(width), height_(height), particles_(n), point_info_(n),
: width_(width), height_(height), point_info_(n), points_(n, {0, 0}),
points_(n, {0, 0}), rng_(std::random_device{}()), dist_(0.0, 1.0) {
rng_(std::random_device{}()), dist_(0.0, 1.0) {
window_.reset(SDL_CreateWindow(
window_.reset(SDL_CreateWindow(
"C++ Particle System!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
"C++ Particle System!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,