diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/audio_listener_2d.cpp (renamed from scene/2d/listener_2d.cpp) | 32 | ||||
-rw-r--r-- | scene/2d/audio_listener_2d.h (renamed from scene/2d/listener_2d.h) | 6 | ||||
-rw-r--r-- | scene/2d/audio_stream_player_2d.cpp | 4 |
3 files changed, 21 insertions, 21 deletions
diff --git a/scene/2d/listener_2d.cpp b/scene/2d/audio_listener_2d.cpp index 444f05f2b1..f16e359a1d 100644 --- a/scene/2d/listener_2d.cpp +++ b/scene/2d/audio_listener_2d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* listener_2d.cpp */ +/* audio_listener_2d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,9 +28,9 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "listener_2d.h" +#include "audio_listener_2d.h" -bool Listener2D::_set(const StringName &p_name, const Variant &p_value) { +bool AudioListener2D::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "current") { if (p_value.operator bool()) { make_current(); @@ -43,7 +43,7 @@ bool Listener2D::_set(const StringName &p_name, const Variant &p_value) { return true; } -bool Listener2D::_get(const StringName &p_name, Variant &r_ret) const { +bool AudioListener2D::_get(const StringName &p_name, Variant &r_ret) const { if (p_name == "current") { if (is_inside_tree() && get_tree()->is_node_being_edited(this)) { r_ret = current; @@ -56,11 +56,11 @@ bool Listener2D::_get(const StringName &p_name, Variant &r_ret) const { return true; } -void Listener2D::_get_property_list(List<PropertyInfo> *p_list) const { +void AudioListener2D::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::BOOL, "current")); } -void Listener2D::_notification(int p_what) { +void AudioListener2D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { if (!get_tree()->is_node_being_edited(this) && current) { @@ -80,33 +80,33 @@ void Listener2D::_notification(int p_what) { } } -void Listener2D::make_current() { +void AudioListener2D::make_current() { current = true; if (!is_inside_tree()) { return; } - get_viewport()->_listener_2d_set(this); + get_viewport()->_audio_listener_2d_set(this); } -void Listener2D::clear_current() { +void AudioListener2D::clear_current() { current = false; if (!is_inside_tree()) { return; } - get_viewport()->_listener_2d_remove(this); + get_viewport()->_audio_listener_2d_remove(this); } -bool Listener2D::is_current() const { +bool AudioListener2D::is_current() const { if (is_inside_tree() && !get_tree()->is_node_being_edited(this)) { - return get_viewport()->get_listener_2d() == this; + return get_viewport()->get_audio_listener_2d() == this; } else { return current; } return false; } -void Listener2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("make_current"), &Listener2D::make_current); - ClassDB::bind_method(D_METHOD("clear_current"), &Listener2D::clear_current); - ClassDB::bind_method(D_METHOD("is_current"), &Listener2D::is_current); +void AudioListener2D::_bind_methods() { + ClassDB::bind_method(D_METHOD("make_current"), &AudioListener2D::make_current); + ClassDB::bind_method(D_METHOD("clear_current"), &AudioListener2D::clear_current); + ClassDB::bind_method(D_METHOD("is_current"), &AudioListener2D::is_current); } diff --git a/scene/2d/listener_2d.h b/scene/2d/audio_listener_2d.h index 0289a8087d..875887acc6 100644 --- a/scene/2d/listener_2d.h +++ b/scene/2d/audio_listener_2d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* listener_2d.h */ +/* audio_listener_2d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -34,8 +34,8 @@ #include "scene/2d/node_2d.h" #include "scene/main/window.h" -class Listener2D : public Node2D { - GDCLASS(Listener2D, Node2D); +class AudioListener2D : public Node2D { + GDCLASS(AudioListener2D, Node2D); private: bool current = false; diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index 8401909384..bddc342c1a 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -31,7 +31,7 @@ #include "audio_stream_player_2d.h" #include "scene/2d/area_2d.h" -#include "scene/2d/listener_2d.h" +#include "scene/2d/audio_listener_2d.h" #include "scene/main/window.h" void AudioStreamPlayer2D::_notification(int p_what) { @@ -156,7 +156,7 @@ void AudioStreamPlayer2D::_update_panning() { Vector2 relative_to_listener; //screen in global is used for attenuation - Listener2D *listener = vp->get_listener_2d(); + AudioListener2D *listener = vp->get_audio_listener_2d(); if (listener) { listener_in_global = listener->get_global_position(); relative_to_listener = global_pos - listener_in_global; |