summaryrefslogtreecommitdiff
path: root/src/net/WebRTCPeerNative.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/WebRTCPeerNative.cpp')
-rw-r--r--src/net/WebRTCPeerNative.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/net/WebRTCPeerNative.cpp b/src/net/WebRTCPeerNative.cpp
index 0e32d61..be9040c 100644
--- a/src/net/WebRTCPeerNative.cpp
+++ b/src/net/WebRTCPeerNative.cpp
@@ -1,16 +1,23 @@
#include "WebRTCPeerNative.hpp"
+const godot_gdnative_ext_net_api_struct *WebRTCPeerNative::_net_api = NULL;
+
+void WebRTCPeerNative::register_interface(const godot_net_webrtc_peer *p_interface) {
+ ERR_FAIL_COND(!_net_api);
+ _net_api->godot_net_bind_webrtc_peer(_owner, p_interface);
+}
+
void WebRTCPeerNative::_register_methods() { }
void WebRTCPeerNative::_init() {
printf("Binding PacketPeer interface");
- godot_net_bind_webrtc_peer(_owner, &interface);
+ register_interface(&interface);
}
WebRTCPeerNative::~WebRTCPeerNative() {
if (_owner) {
printf("Unbinding PacketPeer interface");
- godot_net_bind_webrtc_peer(_owner, NULL);
+ register_interface(NULL);
}
}