-// $Id$
-//
// SuperTux
// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
-
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Ambient Sound Source, gamma version. Features:
*
- * - "rounded rectancle" geometry with position, dimension and
+ * - "rounded rectangle" geometry with position, dimension and
* "rounding radius" (extending in all directions) of a 100%
* volume area, adjustable maximum volume, inverse square
* falloff outside area.
*
* x, y position
* width, height dimension
- * distance_factor high = steep fallofff
+ * distance_factor high = steep falloff
* distance_bias high = big "100% disc"
* silence_distance defaults reasonably.
* sample sample to be played back in loop mode
* basti_
*/
-#ifndef __AMBIENT_SOUND_H__
-#define __AMBIENT_SOUND_H__
+#ifndef HEADER_SUPERTUX_OBJECT_AMBIENT_SOUND_HPP
+#define HEADER_SUPERTUX_OBJECT_AMBIENT_SOUND_HPP
-#include "moving_object.hpp"
-#include "resources.hpp"
-#include "player.hpp"
-#include "script_interface.hpp"
#include "scripting/ambient_sound.hpp"
+#include "supertux/game_object.hpp"
+#include "supertux/script_interface.hpp"
+#include "util/reader_fwd.hpp"
+class Player;
class SoundSource;
-class AmbientSound : public MovingObject, public ScriptInterface, public Scripting::AmbientSound
+class AmbientSound : public GameObject,
+ public ScriptInterface,
+ public Scripting::AmbientSound
{
public:
- AmbientSound(const lisp::Lisp& lisp);
+ AmbientSound(const Reader& lisp);
AmbientSound(Vector pos, float factor, float bias, float vol, std::string file);
~AmbientSound();
- /*void set_pos(Vector newpos)
+ void set_pos(Vector newpos)
{
position=newpos;
}
- const Vector &get_pos() const
- {
- return get_pos();
- }*/
-
- // --- BEGIN METHODS TO EXPOSE TO SQUIRREL --- //
- void set_pos(float x, float y)
- {
- MovingObject::set_pos(x, y);
- }
-
- float get_pos_x() const
- {
- return MovingObject::get_pos_x();
- }
-
- float get_pos_y() const
+ const Vector get_pos() const
{
- return MovingObject::get_pos_y();
+ return position;
}
- // --- END METHODS TO EXPOSE TO SQUIRREL --- //
- HitResponse collision(GameObject&, const CollisionHit&)
- {
- return ABORT_MOVE;
- }
+ /**
+ * @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 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;
+
std::string sample;
SoundSource* sound_source;
int latency;
};
#endif
+
+/* EOF */