cRandom_Sound::cRandom_Sound(XmlAttributes& attributes, cSprite_Manager* sprite_manager) : cSprite(sprite_manager, "sound") { cRandom_Sound::Init(); // filename Set_Filename(attributes["file"]); // position Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true); // Set_Continuous(attributes.fetch<bool>("continuous", m_continuous)); // delay Set_Delay_Min(attributes.fetch<int>("delay_min", m_delay_min)); Set_Delay_Min(attributes.fetch<int>("delay_max", m_delay_max)); // volume Set_Volume_Min(attributes.fetch<float>("volume_min", m_volume_min)); Set_Volume_Max(attributes.fetch<float>("volume_min", m_volume_max)); // volume reduction Set_Volume_Reduction_Begin(attributes.fetch<float>("volume_reduction_begin", m_volume_reduction_begin)); Set_Volume_Reduction_End(attributes.fetch<float>("volume_reduction_end", m_volume_reduction_end)); }
bool cRandom_Sound::Editor_Volume_Min_Text_Changed(const CEGUI::EventArgs& event) { const CEGUI::WindowEventArgs& windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>(event); std::string str_text = static_cast<CEGUI::Editbox*>(windowEventArgs.window)->getText().c_str(); Set_Volume_Min(string_to_float(str_text)); return 1; }
void cRandom_Sound :: Create_From_Stream( CEGUI::XMLAttributes &attributes ) { // filename Set_Filename( attributes.getValueAsString( "file" ).c_str() ); // position Set_Pos( static_cast<float>(attributes.getValueAsInteger( "pos_x" )), static_cast<float>(attributes.getValueAsInteger( "pos_y" )), 1 ); // Set_Continuous( attributes.getValueAsBool( "continuous", m_continuous ) ); // delay Set_Delay_Min( attributes.getValueAsInteger( "delay_min", m_delay_min ) ); Set_Delay_Max( attributes.getValueAsInteger( "delay_max", m_delay_max ) ); // volume Set_Volume_Min( attributes.getValueAsFloat( "volume_min", m_volume_min ) ); Set_Volume_Max( attributes.getValueAsFloat( "volume_max", m_volume_max ) ); // volume reduction Set_Volume_Reduction_Begin( attributes.getValueAsFloat( "volume_reduction_begin", m_volume_reduction_begin ) ); Set_Volume_Reduction_End( attributes.getValueAsFloat( "volume_reduction_end", m_volume_reduction_end ) ); }