X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fambient_sound.hpp;h=a7a14bca770a151da39e9e093cc66d2a91b430f4;hb=5745d9670262c91e6cd35363fd0d2ec169e7c8a4;hp=03d33b5ceca9769c5925dd1a3dde056db539dcc1;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/object/ambient_sound.hpp b/src/object/ambient_sound.hpp index 03d33b5ce..a7a14bca7 100644 --- a/src/object/ambient_sound.hpp +++ b/src/object/ambient_sound.hpp @@ -1,6 +1,7 @@ -// ambient_sound.h basti_ -// +// $Id$ +// // SuperTux +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -11,22 +12,22 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + /** * Ambient Sound Source, gamma version. Features: * - * - "rounded rectancle" geometry with position, dimension and - * "rounding radius" (extending in all directions) of a 100% - * volume area, adjustable maximum volume, inverse square + * - "rounded rectancle" geometry with position, dimension and + * "rounding radius" (extending in all directions) of a 100% + * volume area, adjustable maximum volume, inverse square * falloff outside area. - * + * * - degenerates gracefully to a disc for dimension=0 - * + * * - parameters: * * x, y position @@ -35,8 +36,8 @@ * distance_bias high = big "100% disc" * silence_distance defaults reasonably. * sample sample to be played back in loop mode - * - * basti_ + * + * basti_ */ #ifndef __AMBIENT_SOUND_H__ @@ -45,22 +46,48 @@ #include "game_object.hpp" #include "resources.hpp" #include "player.hpp" +#include "script_interface.hpp" +#include "scripting/ambient_sound.hpp" class SoundSource; -class AmbientSound : public GameObject +class AmbientSound : public GameObject, public ScriptInterface, public Scripting::AmbientSound { public: AmbientSound(const lisp::Lisp& lisp); AmbientSound(Vector pos, float factor, float bias, float vol, std::string file); ~AmbientSound(); + + void set_pos(Vector newpos) + { + position=newpos; + } + const Vector get_pos() const + { + return position; + } + + /** + * @name Scriptable Methods + * @{ + */ + void set_pos(float x, float y); + float get_pos_x() const; + float get_pos_y() const; + /** + * @} + */ + protected: virtual void hit(Player& player); virtual void update(float time); virtual void draw(DrawingContext&); virtual void start_playing(); virtual void stop_playing(); + virtual void expose(HSQUIRRELVM vm, SQInteger table_idx); + virtual void unexpose(HSQUIRRELVM vm, SQInteger table_idx); private: + std::string name; /**< user-defined name for use in scripts or empty string if not scriptable */ Vector position; Vector dimension; @@ -70,7 +97,7 @@ private: float distance_factor; /// distance scaling float distance_bias; /// 100% volume disc radius - float silence_distance; /// not implemented yet + float silence_distance; /// not implemented yet float maximumvolume; /// maximum volume float targetvolume; /// how loud we want to be @@ -80,4 +107,3 @@ private: }; #endif -