-// $Id: light.cpp 3327 2006-04-13 15:02:40Z ravu_al_hemio $
+// $Id$
//
// SuperTux
// Copyright (C) 2006 Ingo Ruhnke <grumbel@gmx.de>
#include "sector.hpp"
Spotlight::Spotlight(const lisp::Lisp& lisp)
+ : angle(0.0f),
+ color(1.0f, 1.0f, 1.0f)
{
lisp.get("x", position.x);
lisp.get("y", position.y);
-
+
+ lisp.get("angle", angle);
+
+ std::vector<float> vColor;
+ if( lisp.get_vector( "color", vColor ) ){
+ color = Color( vColor );
+ }
+
center = sprite_manager->create("images/objects/spotlight/spotlight_center.sprite");
base = sprite_manager->create("images/objects/spotlight/spotlight_base.sprite");
lights = sprite_manager->create("images/objects/spotlight/spotlight_lights.sprite");
lightcone = sprite_manager->create("images/objects/spotlight/lightcone.sprite");
light = sprite_manager->create("images/objects/spotlight/light.sprite");
- angle = 0.0f;
+
}
Spotlight::~Spotlight()
void
Spotlight::draw(DrawingContext& context)
{
- context.push_target();
+ context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
-
+
+ light->set_color(color);
+ light->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
light->set_angle(angle);
light->draw(context, position, 0);
//lightcone->set_angle(angle);
//lightcone->draw(context, position, 0);
-
+
context.set_target(DrawingContext::NORMAL);
lights->set_angle(angle);