diff options
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 650a680d87..162d5568d4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -66,6 +66,8 @@ #include "servers/arvr_server.h" #include "servers/audio_server.h" #include "servers/camera_server.h" +#include "servers/navigation_2d_server.h" +#include "servers/navigation_server.h" #include "servers/physics_2d_server.h" #include "servers/physics_server.h" #include "servers/register_server_types.h" @@ -103,6 +105,8 @@ static CameraServer *camera_server = NULL; static ARVRServer *arvr_server = NULL; static PhysicsServer *physics_server = NULL; static Physics2DServer *physics_2d_server = NULL; +static NavigationServer *navigation_server = NULL; +static Navigation2DServer *navigation_2d_server = NULL; // We error out if setup2() doesn't turn this true static bool _start_success = false; @@ -197,6 +201,19 @@ void finalize_physics() { memdelete(physics_2d_server); } +void initialize_navigation_server() { + ERR_FAIL_COND(navigation_server != NULL); + navigation_server = NavigationServerManager::new_default_server(); + navigation_2d_server = memnew(Navigation2DServer); +} + +void finalize_navigation_server() { + memdelete(navigation_server); + navigation_server = NULL; + memdelete(navigation_2d_server); + navigation_2d_server = NULL; +} + //#define DEBUG_INIT #ifdef DEBUG_INIT #define MAIN_PRINT(m_txt) print_line(m_txt) @@ -1356,6 +1373,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { camera_server = CameraServer::create(); initialize_physics(); + initialize_navigation_server(); register_server_singletons(); register_driver_types(); @@ -2011,6 +2029,8 @@ bool Main::iteration() { message_queue->flush(); + NavigationServer::get_singleton_mut()->step(frame_slice * time_scale); + PhysicsServer::get_singleton()->step(frame_slice * time_scale); Physics2DServer::get_singleton()->end_sync(); @@ -2202,6 +2222,7 @@ void Main::cleanup() { OS::get_singleton()->finalize(); finalize_physics(); + finalize_navigation_server(); if (packed_data) memdelete(packed_data); |