Example #1
0
void
Light::draw(DrawingContext& context)
{
  sprite->set_color(color);
  sprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
  sprite->draw(context.light(), position, 0);
}
Example #2
0
void
BadGuy::draw(DrawingContext& context)
{
  if (!m_sprite.get()) return;

  if (m_state == STATE_INIT || m_state == STATE_INACTIVE)
  {
    if (Editor::is_active()) {
      m_sprite->draw(context.color(), get_pos(), m_layer);
    }
  }
  else
  {
    if (m_state == STATE_FALLING) {
      context.push_transform();
      context.set_flip(context.get_flip() ^ VERTICAL_FLIP);
      m_sprite->draw(context.color(), get_pos(), m_layer);
      context.pop_transform();
    } else {
      m_sprite->draw(context.color(), get_pos(), m_layer);
    }

    if (m_glowing) {
      m_lightsprite->draw(context.light(), m_col.m_bbox.get_middle(), 0);
    }
  }
}
Example #3
0
void
TreeWillOWisp::draw(DrawingContext& context)
{
  sprite->draw(context.color(), get_pos(), layer);

  sprite->draw(context.light(), get_pos(), layer);
}
Example #4
0
void
MagicBlock::draw(DrawingContext& context){
  // Ask for update about lightmap at center of this block
  context.light().get_pixel( center, &light );

  MovingSprite::draw(context);
  context.color().draw_filled_rect( bbox, color, layer);
}
Example #5
0
void
Firefly::draw(DrawingContext& context)
{
  MovingSprite::draw(context);

  if (sprite_name.find("torch", 0) != std::string::npos && (activated ||
        sprite->get_action() == "ringing")) {
    m_sprite_light->draw(context.light(), bbox.get_middle() - TORCH_LIGHT_OFFSET, 0);
  }
}
Example #6
0
void
BonusBlock::draw(DrawingContext& context){
  // do the regular drawing first
  Block::draw(context);
  // then Draw the light if on.
  if(sprite->get_action() == "on") {
    Vector pos = get_pos() + (bbox.get_size().as_vector() - lightsprite->get_size()) / 2;
    context.light().draw_surface(lightsprite, pos, 10);
  }
}
Example #7
0
void
Flower::draw(DrawingContext& context)
{
  //Draw the Sprite.
  sprite->draw(context.color(), get_pos(), LAYER_OBJECTS, drawing_effect);
  //Draw the light when dark
  context.get_light( bbox.get_middle(), &light );
  if (light.red + light.green + light.blue < 3.0){
    lightsprite->draw(context.light(), bbox.get_middle(), 0);
  }
}
Example #8
0
void
PowerUp::draw(DrawingContext& context)
{
  sprite->draw(context.color(), get_pos(), layer);

  // Stars are brighter
  if (sprite_name == "images/powerups/star/star.sprite")
  {
    sprite->draw(context.color(), get_pos(), layer);
  }

  lightsprite->draw(context.light(), bbox.get_middle(), 0);
}
Example #9
0
void
Explosion::draw(DrawingContext& context)
{
  sprite->draw(context.color(), get_pos(), LAYER_OBJECTS+40);
  lightsprite->draw(context.light(), bbox.get_middle(), 0);
}