diff options
Diffstat (limited to 'servers/physics_2d_server.h')
| -rw-r--r-- | servers/physics_2d_server.h | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 18f4f460b6..241255bdb5 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -252,7 +252,15 @@ public: SHAPE_CUSTOM, ///< Server-Implementation based custom shape, calling shape_create() with this value will result in an error }; - virtual RID shape_create(ShapeType p_shape) = 0; + virtual RID line_shape_create() = 0; + virtual RID ray_shape_create() = 0; + virtual RID segment_shape_create() = 0; + virtual RID circle_shape_create() = 0; + virtual RID rectangle_shape_create() = 0; + virtual RID capsule_shape_create() = 0; + virtual RID convex_polygon_shape_create() = 0; + virtual RID concave_polygon_shape_create() = 0; + virtual void shape_set_data(RID p_shape, const Variant &p_data) = 0; virtual void shape_set_custom_solver_bias(RID p_shape, real_t p_bias) = 0; @@ -366,7 +374,7 @@ public: //BODY_MODE_SOFT ?? }; - virtual RID body_create(BodyMode p_mode = BODY_MODE_RIGID, bool p_init_sleeping = false) = 0; + virtual RID body_create() = 0; virtual void body_set_space(RID p_body, RID p_space) = 0; virtual RID body_get_space(RID p_body) const = 0; @@ -590,6 +598,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); |