#include "log.hpp"
namespace {
- const float LIGHTNING_DELAY = 2.0;
- const float FLASH_DISPLAY_TIME = 0.1;
+ const float LIGHTNING_DELAY = 2.0f;
+ const float FLASH_DISPLAY_TIME = 0.1f;
}
Thunderstorm::Thunderstorm(const lisp::Lisp& reader)
- : name(""), running(true), interval(10.0f)
+ : running(true), interval(10.0f), layer(LAYER_BACKGROUNDTILES-1)
{
reader.get("name", name);
reader.get("running", running);
if(interval <= 0) {
log_warning << "Running a thunderstorm with non-positive time interval is a bad idea" << std::endl;
}
+ reader.get("layer", layer);
sound_manager->preload("sounds/explosion.wav");
sound_manager->preload("sounds/upgrade.wav");
}
}
-void
-Thunderstorm::draw(DrawingContext& context)
+void
+Thunderstorm::draw(DrawingContext& context)
{
if (!flash_display_timer.started()) return;
float alpha = 0.33f;
context.push_transform();
context.set_translation(Vector(0, 0));
- context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), LAYER_BACKGROUNDTILES-1);
+ context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(1, 1, 1, alpha), layer);
context.pop_transform();
}
}
IMPLEMENT_FACTORY(Thunderstorm, "thunderstorm");
-