src/object/ambient_sound.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00039 #ifndef HEADER_SUPERTUX_OBJECT_AMBIENT_SOUND_HPP
00040 #define HEADER_SUPERTUX_OBJECT_AMBIENT_SOUND_HPP
00041 
00042 #include "scripting/ambient_sound.hpp"
00043 #include "supertux/game_object.hpp"
00044 #include "supertux/script_interface.hpp"
00045 #include "util/reader_fwd.hpp"
00046 
00047 class Player;
00048 class SoundSource;
00049 
00050 class AmbientSound : public GameObject, 
00051                      public ScriptInterface, 
00052                      public scripting::AmbientSound
00053 {
00054 public:
00055   AmbientSound(const Reader& lisp);
00056   AmbientSound(Vector pos, float factor, float bias, float vol, std::string file);
00057   ~AmbientSound();
00058 
00059   void set_pos(Vector newpos)
00060   {
00061     position=newpos;
00062   }
00063   const Vector get_pos() const
00064   {
00065     return position;
00066   }
00067 
00072   void set_pos(float x, float y);
00073   float get_pos_x() const;
00074   float get_pos_y() const;
00079 protected:
00080   virtual void hit(Player& player);
00081   virtual void update(float time);
00082   virtual void draw(DrawingContext&);
00083   virtual void start_playing();
00084   virtual void stop_playing();
00085   virtual void expose(HSQUIRRELVM vm, SQInteger table_idx);
00086   virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx);
00087 
00088 private:
00089   std::string name; 
00090   Vector position;
00091   Vector dimension;
00092 
00093   std::string sample;
00094   SoundSource* sound_source;
00095   int latency;
00096 
00097   float distance_factor;  
00098   float distance_bias;    
00099   float silence_distance; 
00100 
00101   float maximumvolume; 
00102   float targetvolume;  
00103   float currentvolume; 
00104 
00105   float * volume_ptr; 
00106 
00107 private:
00108   AmbientSound(const AmbientSound&);
00109   AmbientSound& operator=(const AmbientSound&);
00110 };
00111 
00112 #endif
00113 
00114 /* EOF */

Generated on Mon Jun 9 03:38:19 2014 for SuperTux by  doxygen 1.5.1