/** * \brief Initialize a slope. * \param slope A reference to the pointer of the slope. * \param s The steepness. * \param z The z position of the slope. */ void rp::switching::init_slope( bear::slope*& slope, double s, int z ) { if ( slope == NULL ) { slope = new bear::slope; if ( s < 0 ) slope->set_size( get_width(), get_height() / 2 ); else slope->set_size( get_size() ); const double effective_steepness = get_rendering_attributes().is_mirrored() ? -s : s; slope->set_bottom_left( get_bottom_left() ); slope->set_steepness( effective_steepness ); slope->set_top_friction( 0.95 ); slope->set_max_z_for_collision( z + 100 ); slope->set_z_position(z); slope->set_z_shift(100); slope->set_force_z_position(true); new_item(*slope); } else get_layer().add_item(*slope); } // rp::switching::init_slope()
/** * \brief Initialise the item. */ void bear::rolling_credits::build() { super::build(); std::stringstream iss; engine::resource_pool::get_instance().get_file(m_file, iss); if ( m_fading_frac < 0 ) m_fading_frac = 1.0 / 4; else // initially, m_fading_frac contains the duration of the fading m_fading_frac /= m_movement_duration; std::string line; visual::font font; double font_size(12); double red(1), green(1), blue(1), opacity(1); visual::text_align::horizontal_align horizontal_align ( visual::text_align::align_center ); visual::size_type width( get_width() ); while ( claw::text::getline(iss, line) ) if ( line.empty() ) m_lines.push_back ( credit_line ( line, font, red, green, blue, opacity, get_bottom_left(), width, horizontal_align ) ); else if ( line[0] == '#' ) { std::string s; std::istringstream iss_line(line); iss_line >> s; if ( s == "#color" ) { red = green = blue = opacity = 1; iss_line >> red >> green >> blue >> opacity; }
/** * \brief Start idle state. */ void ptb::gorilla::start_idle() { m_scan_distance = 320; m_progress = &gorilla::progress_idle; m_origin_position = get_bottom_left(); } // gorilla::start_idle()