#include <light.hpp>
Inherits GameObject.
Inherited by PulsingLight.
Public Member Functions | |
Light (const Vector ¢er, const Color &color=Color(1.0, 1.0, 1.0, 1.0)) | |
virtual | ~Light () |
void | update (float elapsed_time) |
This function is called once per frame and allows the object to update it's state. | |
void | draw (DrawingContext &context) |
The GameObject should draw itself onto the provided DrawingContext if this function is called. | |
Protected Attributes | |
Vector | position |
Color | color |
SpritePtr | sprite |
Definition at line 27 of file light.hpp.
Definition at line 21 of file light.cpp.
References SpriteManager::create(), sprite, and sprite_manager.
00021 : 00022 position(center), 00023 color(color), 00024 sprite() 00025 { 00026 sprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite"); 00027 }
void Light::update | ( | float | elapsed_time | ) | [virtual] |
This function is called once per frame and allows the object to update it's state.
The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)
Implements GameObject.
Reimplemented in PulsingLight.
Definition at line 34 of file light.cpp.
Referenced by PulsingLight::update().
void Light::draw | ( | DrawingContext & | context | ) | [virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Reimplemented in PulsingLight.
Definition at line 39 of file light.cpp.
References color, GL_ONE, GL_SRC_ALPHA, DrawingContext::LIGHTMAP, DrawingContext::pop_target(), position, DrawingContext::push_target(), DrawingContext::set_target(), and sprite.
Referenced by PulsingLight::draw().
00040 { 00041 context.push_target(); 00042 context.set_target(DrawingContext::LIGHTMAP); 00043 00044 sprite->set_color(color); 00045 sprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); 00046 sprite->set_angle(90); // FIXME: color won't get applied for angle=0 00047 sprite->draw(context, position, 0); 00048 00049 context.pop_target(); 00050 }
Vector Light::position [protected] |
Color Light::color [protected] |
SpritePtr Light::sprite [protected] |