4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "fireworks.hpp"
23 #include "resources.hpp"
26 #include "particles.hpp"
28 #include "video/drawing_context.hpp"
29 #include "audio/sound_manager.hpp"
30 #include "random_generator.hpp"
32 Fireworks::Fireworks()
35 sound_manager->preload("sounds/fireworks.wav");
38 Fireworks::~Fireworks()
43 Fireworks::update(float )
46 Sector* sector = Sector::current();
47 Vector pos = sector->camera->get_translation();
48 pos += Vector(systemRandom.randf(SCREEN_WIDTH),
49 systemRandom.randf(SCREEN_HEIGHT/2));
51 float red = systemRandom.randf(1.0);
52 float green = systemRandom.randf(1.0);
57 sector->add_object(new Particles(pos, 0, 360, Vector(140, 140),
58 Vector(0, 0), 45, Color(red, green, 0), 3, 1.3,
59 LAYER_FOREGROUND1+1));
60 sound_manager->play("sounds/fireworks.wav");
61 timer.start(systemRandom.randf(1.0, 1.5));
66 Fireworks::draw(DrawingContext& )