summaryrefslogtreecommitdiff
path: root/scene/main/viewport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r--scene/main/viewport.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 8ec8c193fb..c5b0f47140 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -37,6 +37,7 @@
#include "core/templates/pair.h"
#include "scene/2d/camera_2d.h"
#include "scene/2d/collision_object_2d.h"
+#include "scene/2d/listener_2d.cpp"
#ifndef _3D_DISABLED
#include "scene/3d/camera_3d.h"
#include "scene/3d/collision_object_3d.h"
@@ -831,7 +832,6 @@ void Viewport::set_as_audio_listener_2d(bool p_enable) {
}
audio_listener_2d = p_enable;
-
_update_listener_2d();
}
@@ -839,6 +839,10 @@ bool Viewport::is_audio_listener_2d() const {
return audio_listener_2d;
}
+Listener2D *Viewport::get_listener_2d() const {
+ return listener_2d;
+}
+
void Viewport::enable_canvas_transform_override(bool p_enable) {
if (override_canvas_transform == p_enable) {
return;
@@ -903,6 +907,21 @@ void Viewport::_camera_2d_set(Camera2D *p_camera_2d) {
camera_2d = p_camera_2d;
}
+void Viewport::_listener_2d_set(Listener2D *p_listener) {
+ if (listener_2d == p_listener) {
+ return;
+ } else if (listener_2d) {
+ listener_2d->clear_current();
+ }
+ listener_2d = p_listener;
+}
+
+void Viewport::_listener_2d_remove(Listener2D *p_listener) {
+ if (listener_2d == p_listener) {
+ listener_2d = nullptr;
+ }
+}
+
void Viewport::_canvas_layer_add(CanvasLayer *p_canvas_layer) {
canvas_layers.insert(p_canvas_layer);
}