From c067b45badc1a4408d3dfb1b947f32b2aee49451 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Sun, 25 Jun 2006 14:14:33 +0000 Subject: [PATCH] Fixed problem with Cloud particles popping out of view at screen edge SVN-Revision: 3745 --- src/object/particlesystem.cpp | 10 ++++++---- src/object/particlesystem.hpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/object/particlesystem.cpp b/src/object/particlesystem.cpp index 82446049b..a58a7d4d1 100644 --- a/src/object/particlesystem.cpp +++ b/src/object/particlesystem.cpp @@ -32,10 +32,11 @@ #include "object/camera.hpp" #include "random_generator.hpp" -ParticleSystem::ParticleSystem() +ParticleSystem::ParticleSystem(float max_particle_size) + : max_particle_size(max_particle_size) { - virtual_width = SCREEN_WIDTH + MAX_PARTICLE_SIZE * 2; - virtual_height = SCREEN_HEIGHT + MAX_PARTICLE_SIZE *2; + virtual_width = SCREEN_WIDTH + max_particle_size * 2; + virtual_height = SCREEN_HEIGHT + max_particle_size *2; z_pos = LAYER_BACKGROUND1; } @@ -53,7 +54,7 @@ void ParticleSystem::draw(DrawingContext& context) float scrolly = context.get_translation().y; context.push_transform(); - context.set_translation(Vector(MAX_PARTICLE_SIZE,MAX_PARTICLE_SIZE)); + context.set_translation(Vector(max_particle_size,max_particle_size)); std::vector::iterator i; for(i = particles.begin(); i != particles.end(); ++i) { @@ -205,6 +206,7 @@ void GhostParticleSystem::update(float elapsed_time) } CloudParticleSystem::CloudParticleSystem() + : ParticleSystem(128) { cloudimage = new Surface("images/objects/particles/cloud.png"); diff --git a/src/object/particlesystem.hpp b/src/object/particlesystem.hpp index 3952cca22..dd356f82c 100644 --- a/src/object/particlesystem.hpp +++ b/src/object/particlesystem.hpp @@ -52,13 +52,13 @@ class DisplayManager; class ParticleSystem : public GameObject { public: - ParticleSystem(); + ParticleSystem(float max_particle_size = 60); virtual ~ParticleSystem(); virtual void draw(DrawingContext& context); protected: - enum {MAX_PARTICLE_SIZE = 64}; + float max_particle_size; int z_pos; class Particle -- 2.11.0