diff options
author | AndreaCatania <info@andreacatania.com> | 2017-10-21 13:02:06 +0200 |
---|---|---|
committer | AndreaCatania <info@andreacatania.com> | 2017-11-04 03:25:51 +0100 |
commit | 7a9ca08f16c500aa0caccc21a8e42564f962971a (patch) | |
tree | 3274c444cab28252757a1dde47995264ac2d2c66 /servers/physics_2d_server.h | |
parent | f52ab8d86418a67ddee247ed7765e72935b0c57f (diff) |
Implemented physics plug
Moved init_physics
Implemented physics 2D plug
Fix clang
Fix clang
Fix static check
Fix clang
Fix static check
Moved physics server initialization
Moved physics server settings initialization
Diffstat (limited to 'servers/physics_2d_server.h')
-rw-r--r-- | servers/physics_2d_server.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 18f4f460b6..ddd1555768 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -590,6 +590,43 @@ public: Physics2DTestMotionResult(); }; +typedef Physics2DServer *(*CreatePhysics2DServerCallback)(); + +class Physics2DServerManager { + struct ClassInfo { + String name; + CreatePhysics2DServerCallback create_callback; + + ClassInfo() + : name(""), create_callback(NULL) {} + + ClassInfo(String p_name, CreatePhysics2DServerCallback 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_2d_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, CreatePhysics2DServerCallback 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 Physics2DServer *new_default_server(); + static Physics2DServer *new_server(const String &p_name); +}; + VARIANT_ENUM_CAST(Physics2DServer::ShapeType); VARIANT_ENUM_CAST(Physics2DServer::SpaceParameter); VARIANT_ENUM_CAST(Physics2DServer::AreaParameter); |