X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fobject%2Fcloud_particle_system.cpp;h=2cbbca2732c1393bfb66e2f536977cdf1da8ec3b;hb=2372988b5c58303f17720945e14d48c7aebc95ee;hp=0e2659e51626f13ffbc3bb82e740643176ae94ba;hpb=abcb5a66b00aff23c5f1587646f9298fc0a9d8be;p=supertux.git diff --git a/src/object/cloud_particle_system.cpp b/src/object/cloud_particle_system.cpp index 0e2659e51..2cbbca273 100644 --- a/src/object/cloud_particle_system.cpp +++ b/src/object/cloud_particle_system.cpp @@ -19,24 +19,24 @@ #include #include "math/random_generator.hpp" -#include "supertux/main.hpp" +#include "supertux/globals.hpp" #include "video/drawing_context.hpp" CloudParticleSystem::CloudParticleSystem() : ParticleSystem(128), cloudimage() { - cloudimage = new Surface("images/objects/particles/cloud.png"); + cloudimage = Surface::create("images/objects/particles/cloud.png"); virtual_width = 2000.0; // create some random clouds for(size_t i=0; i<15; ++i) { CloudParticle* particle = new CloudParticle; - particle->pos.x = systemRandom.rand(static_cast(virtual_width)); - particle->pos.y = systemRandom.rand(static_cast(virtual_height)); + particle->pos.x = graphicsRandom.rand(static_cast(virtual_width)); + particle->pos.y = graphicsRandom.rand(static_cast(virtual_height)); particle->texture = cloudimage; - particle->speed = -systemRandom.randf(25.0, 54.0); + particle->speed = -graphicsRandom.randf(25.0, 54.0); particles.push_back(particle); } @@ -45,12 +45,11 @@ CloudParticleSystem::CloudParticleSystem() : void CloudParticleSystem::parse(const Reader& reader) { - reader.get("z-pos", z_pos); + z_pos = reader_get_layer (reader, /* default = */ LAYER_BACKGROUND1); } CloudParticleSystem::~CloudParticleSystem() { - delete cloudimage; } void CloudParticleSystem::update(float elapsed_time)