00001 // ///////////////////////////////////////////////////////////////////////////// 00002 // 00003 // Name: SoundListenerComponent.h 00004 // Author: Michael Bartsch (ZCCdark203) 00005 // 00006 // Desc : Declaration of the SoundListenerComponent class. 00007 // 00008 // License: Copyright (C) 2009 Michael Bartsch and Contributors 00009 // 00010 // This program is free software: you can redistribute it 00011 // and/or modify it under the terms of the zlib/libpng License. 00012 // See main.cpp for conditions of distribution and use. 00013 // 00014 // ///////////////////////////////////////////////////////////////////////////// 00015 00016 #ifndef __SOUNDLISTENERCOMPONENT_H__ 00017 #define __SOUNDLISTENERCOMPONENT_H__ 00018 00019 // Include files 00020 #include "../../dependencies.h" 00021 #include "../../core/EntityComponent.h" 00022 00023 00024 // SoundListenerComponent class 00026 class SoundListenerComponent : public EntityComponent 00027 { 00028 public: 00029 00030 // Initialisation and deinitialisation 00034 SoundListenerComponent(Entity *parent, bool isMainListener = true); 00036 ~SoundListenerComponent(); 00037 00038 // AngelScript binding 00041 static SoundListenerComponent* refFactory(Entity *parent, bool isMainListener = true); 00042 00043 // Methods 00045 bool getIsMainListener() const; 00047 const vector3df& getTarget() const; 00048 00051 void setIsMainListener(bool value = true); 00054 void setTarget(const vector3df &target); 00055 00056 // Events 00059 void onPositionChange(void *p); 00062 void onPause(void *p); 00065 void onUnPause(void *p); 00066 00067 private: 00068 00069 // Static Members 00070 static SoundListenerComponent *mMainListener; 00071 00072 // Members 00073 vector3df mPosition; 00074 vector3df mTarget; 00075 00076 bool mIsMainListener; 00077 bool mWasMainListener; // For event handeling 00078 }; 00079 00080 00081 // SoundListenerComponent Angelscript binding. 00083 extern void bindSoundListenerComponent(asIScriptEngine *engine); 00084 00085 #endif