diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-11-03 23:39:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-03 23:39:44 -0300 |
commit | 7715a261d5f387b7769bb8149735e4131ea97757 (patch) | |
tree | 41a3bfe4c655470a3e7b9b5e162e48853ca561d2 /servers/physics_server.h | |
parent | 25c38c75425e3ccfcaed53ebd38fc588d6f35764 (diff) | |
parent | 7a9ca08f16c500aa0caccc21a8e42564f962971a (diff) |
Merge pull request #12262 from AndreaCatania/pplug
Physics server plug
Diffstat (limited to 'servers/physics_server.h')
-rw-r--r-- | servers/physics_server.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/servers/physics_server.h b/servers/physics_server.h index 8cec125646..09990cd02a 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -658,6 +658,43 @@ public: ~PhysicsServer(); }; +typedef PhysicsServer *(*CreatePhysicsServerCallback)(); + +class PhysicsServerManager { + struct ClassInfo { + String name; + CreatePhysicsServerCallback create_callback; + + ClassInfo() + : name(""), create_callback(NULL) {} + + ClassInfo(String p_name, CreatePhysicsServerCallback p_create_callback) + : name(p_name), create_callback(p_create_callback) {} + + ClassInfo(const ClassInfo &p_ci) + : name(p_ci.name), create_callback(p_ci.create_callback) {} + }; + + static Vector<ClassInfo> physics_servers; + static int default_server_id; + static int default_server_priority; + +public: + static const String setting_property_name; + +private: + static void on_servers_changed(); + +public: + static void register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback); + static void set_default_server(const String &p_name, int p_priority = 0); + static int find_server_id(const String &p_name); + static int get_servers_count(); + static String get_server_name(int p_id); + static PhysicsServer *new_default_server(); + static PhysicsServer *new_server(const String &p_name); +}; + VARIANT_ENUM_CAST(PhysicsServer::ShapeType); VARIANT_ENUM_CAST(PhysicsServer::SpaceParameter); VARIANT_ENUM_CAST(PhysicsServer::AreaParameter); |