/**
 * \brief Render the players oxygen.
 * \param e (out) The scene elements.
 */
void ptb::throwable_item_component::render( scene_element_list& e ) const
{
  bear::visual::coordinate_type pos_y = height() / 2;

  bear::visual::scene_sprite s1
    ( get_render_position().x, 
      ( pos_y - m_throwable_item_animation.get_sprite().height() ) / 2 + 
      get_render_position().y, 
      m_throwable_item_animation.get_sprite());

  bear::visual::scene_writing s2
    ( get_render_position().x + 
      m_throwable_item_animation.get_max_size().x + s_margin, 
      ( pos_y - m_throwable_item.get_height() ) / 2 + 
      get_render_position().y , m_throwable_item );

  e.push_back( s1 );
  e.push_back( s2 );

  floating_bonus_list::const_iterator it;
  for ( it = m_floating_bonus.begin(); 
	it != m_floating_bonus.end(); ++it )
    {
      bear::visual::scene_sprite sp2
	( it->get_position().x, it->get_position().y, 
          get_level_globals().auto_sprite( "gfx/ui/ui-1.png", it->get_name() ));
      e.push_back( sp2 );
    } 
} // throwable_item_component::render()
/**
 * \brief Render the arrow.
 * \param e (out) The scene elements.
 */
void ptb::player_arrows_layer::player_data::render
( scene_element_list& e ) const
{
  if (m_visible)
    {
      e.push_back
        ( bear::visual::scene_sprite(m_position.x, m_position.y, m_arrow) );

      e.push_back
        ( bear::visual::scene_writing
          (m_distance_text_position.x, m_distance_text_position.y,
           m_distance) );
    }
} // player_arrows_layer::player_data::render()
/**
 * \brief Render the players oxygen.
 * \param e (out) The scene elements.
 */
void ptb::honeypots_component::render( scene_element_list& e ) const
{
  for ( unsigned int i = 0; i != m_last_count; ++i )
    e.push_back
      ( bear::visual::scene_sprite
	( get_render_position().x + i * (s_margin + m_honeypot.width()), 
	  get_render_position().y, m_honeypot) );
} // honeypots_component::render()
Example #4
0
/**
 * \brief Render the components of the effect.
 * \param e (out) The scene elements.
 */
void bear::engine::strip_effect::render( scene_element_list& e ) const
{
  visual::coordinate_type h(m_height);

  if ( m_elapsed_time
       >= m_strip_in_duration + m_full_duration + m_strip_out_duration )
    return;

  if ( m_elapsed_time < m_strip_in_duration )
    h = m_height * m_elapsed_time / m_strip_in_duration;
  else if ( m_elapsed_time > m_strip_in_duration + m_full_duration )
    h = m_height
      * ( 1 - ( (m_elapsed_time - m_strip_in_duration - m_full_duration)
                / m_strip_out_duration ) );

  e.push_back
    ( visual::scene_rectangle
      ( 0, 0, m_color,
        visual::rectangle_type(0, 0, get_layer().get_size().x, h) ) );
  e.push_back
    ( visual::scene_rectangle
      ( 0, get_layer().get_size().y - h, m_color,
        visual::rectangle_type(0, 0, get_layer().get_size().x, h) ) );
} // strip_effect::render()
Example #5
0
/**
 * \brief Render the component.
 * \param e (out) The scene elements.
 */
void rp::balloon_component::render( scene_element_list& e ) const
{
  if ( game_variables::is_level_ending() )
    return;

  const double current_scale( height() / m_balloon.get_height() );
  const double required_scale( current_scale * 0.75 );

  const double required_left_position
    ( get_render_position().x + width()
      - m_required_balloon.get_width() * required_scale );

  bear::visual::scene_writing required
    ( required_left_position,
      get_render_position().y - 0 * ( height() * (1 - required_scale) ),
      m_required_balloon );

  required.set_scale_factor( required_scale, required_scale );

  required.set_shadow( 1, -1 );
  required.set_shadow_opacity( 0.6 );

  e.push_back( required );

  bear::visual::scene_writing current
    ( required_left_position - m_balloon.get_width() * current_scale,
      get_render_position().y,
      m_balloon );

  current.set_scale_factor( current_scale, current_scale );

  current.set_shadow( 2, -2 );
  current.set_shadow_opacity( 0.6 );

  e.push_back( current );
} // balloon_component::render()
/**
 * \brief Render the players oxygen.
 * \param e (out) The scene elements.
 */
void ptb::corrupting_bonus_component::render( scene_element_list& e ) const
{
  if ( m_corrupting_bonus.empty() )
    return;

  bear::universe::position_type pos(get_render_position());
  bear::visual::scene_sprite sp( 0, 0, m_corrupting_bonus.get_sprite() );

  //sp.set_scale_factor(m_corrupting_bonus_scale, m_corrupting_bonus_scale);
  sp.set_position
    ( pos.x + (m_corrupting_bonus.width() - sp.get_bounding_box().width()) / 2,
      pos.y + (height() - sp.get_bounding_box().height()) / 2 );
  e.push_back( sp );

  pos.x += m_corrupting_bonus.width() + s_margin;

  bear::visual::scene_writing s( 0, 0, m_text_corrupting_bonus );
  //s.set_scale_factor(m_corrupting_bonus_scale, m_corrupting_bonus_scale);
  s.set_position
    ( pos.x
      + ( m_text_corrupting_bonus.get_width()
          - s.get_bounding_box().width() ) / 2,
      pos.y + (height() - s.get_bounding_box().height()) / 2 );

  e.push_back( s );
  
  floating_corrupting_bonus_list::const_iterator it;
  for ( it = m_floating_corrupting_bonus.begin(); 
	it != m_floating_corrupting_bonus.end(); ++it )
    {
      bear::visual::scene_sprite sp2
	( it->get_position().x, it->get_position().y, 
	  m_corrupting_bonus.get_sprite() );
      e.push_back( sp2 );
    } 
} // corrupting_bonus_component::render()
Example #7
0
/**
 * \brief Render the component.
 * \param e (out) The scene elements.
 */
void tunnel::energy_component::render( scene_element_list& e ) const
{
  unsigned int nb = game_variables::get_energy();

  for ( unsigned int i = 0; i < 5; ++i )
    {
      bear::visual::scene_sprite s
        ( get_render_position().x + 2 + i * (m_sprite.width() + s_margin ),
          get_render_position().y, m_sprite);
      if ( i >= nb )
        s.get_rendering_attributes().set_color
          (bear::visual::color_type("#000000"));
      e.push_back( s ); 
    } 
} // energy_component::render()
Example #8
0
/**
 * \brief Render the component.
 * \param e (out) The scene elements.
 */
void rp::score_component::render( scene_element_list& e ) const
{
  if ( ! game_variables::is_level_ending() )
    {
      bear::visual::scene_writing s
        ( get_render_position().x + ( width() - m_score.get_width() ) / 2,
          get_render_position().y + ( height() - m_score.get_height() ) / 2,
          m_score );

      e.push_back( s );
    }

  floating_score_list::const_iterator it;
  for ( it = m_floating_score.begin();
	it != m_floating_score.end(); ++it )
    it->render(e);
} // score_component::render()
Example #9
0
/**
 * \brief Render the component.
 * \param e (out) The scene elements.
 */
void rp::boss_component::render( scene_element_list& e ) const
{
  if ( ! game_variables::is_level_ending() )
    {
      unsigned int nb = game_variables::get_boss_hits();
      bear::visual::position_type pos = get_render_position();

      for ( unsigned int i = 0; i != 3; i++ )
        {
          bear::visual::scene_sprite s( pos.x, pos.y, m_sprite);
          if ( nb > i )
            s.get_rendering_attributes().set_intensity(0,0,0);
          e.push_back( s ); 
          
          pos.x += m_sprite.width() + s_margin;
        }
    }
} // boss_component::render()
Example #10
0
/**
 * \brief Splits the element in sub elements.
 * \param boxes The boxes describing how to split the element.
 * \param output The resulting elements (they are inserted to the back).
 */
void bear::visual::scene_shader_pop::burst
( const rectangle_list& boxes, scene_element_list& output ) const
{
    output.push_back( scene_element(*this) );
} // scene_shader_pop::burst()
/**
 * \brief Render the players oxygen.
 * \param e (out) The scene elements.
 */
void ptb::score_component::render( scene_element_list& e ) const
{
  bear::visual::scene_writing s1
    ( get_render_position().x, get_render_position().y, m_score );
  e.push_back( s1 );
} // score_component::render()