#include "audio/sound_manager.hpp"
#include "audio/sound_source.hpp"
#include "log.hpp"
-#include "scripting/ambient_sound.hpp"
#include "scripting/squirrel_util.hpp"
AmbientSound::AmbientSound(const lisp::Lisp& lisp)
void
AmbientSound::expose(HSQUIRRELVM vm, SQInteger table_idx)
{
- if (name == "") return;
- Scripting::AmbientSound* interface = new Scripting::AmbientSound(this);
- expose_object(vm, table_idx, interface, name, true);
+ Scripting::AmbientSound* interface = static_cast<Scripting::AmbientSound*> (this);
+ expose_object(vm, table_idx, interface, name, false);
}
void
AmbientSound::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
{
- if (name == "") return;
Scripting::unexpose_object(vm, table_idx, name);
}
+void
+AmbientSound::set_pos(float x, float y){
+ position.x = x;
+ position.y = y;
+}
+
+float
+AmbientSound::get_pos_x(){;
+ return position.x;
+}
+
+float
+AmbientSound::get_pos_y(){
+ return position.y;
+}
+
IMPLEMENT_FACTORY(AmbientSound, "ambient_sound");
#include "resources.hpp"
#include "player.hpp"
#include "script_interface.hpp"
+#include "scripting/ambient_sound.hpp"
class SoundSource;
-class AmbientSound : public GameObject, public ScriptInterface
+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;
{
return position;
}
+
+ // --- Scripting Interface ---
+
+ void set_pos(float x, float y);
+ float get_pos_x();
+ float get_pos_y();
+
protected:
virtual void hit(Player& player);
virtual void update(float time);
--- /dev/null
+#ifndef __SCRIPTING_AMBIENT_SOUND_H__
+#define __SCRIPTING_AMBIENT_SOUND_H__
+
+namespace Scripting
+{
+
+class AmbientSound
+{
+public:
+#ifndef SCRIPTING_API
+ virtual ~AmbientSound()
+ {}
+#endif
+
+ virtual void set_pos(float x, float y) = 0;
+ virtual float get_pos_x() = 0;
+ virtual float get_pos_y() = 0;
+};
+
+}
+
+#endif
+