summaryrefslogtreecommitdiff
path: root/servers/physics_server.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics_server.h')
-rw-r--r--servers/physics_server.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 8cec125646..7cccd9b4cb 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -357,7 +357,7 @@ public:
BODY_MODE_STATIC,
BODY_MODE_KINEMATIC,
BODY_MODE_RIGID,
- //BODY_MODE_SOFT
+ BODY_MODE_SOFT,
BODY_MODE_CHARACTER
};
@@ -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);