12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include "space_2d.h"
- RID Space2D::get_rid() const {
- return space;
- }
- void Space2D::set_active(bool p_active) {
- active = p_active;
- Physics2DServer::get_singleton()->space_set_active(space, active);
- }
- bool Space2D::is_active() const {
- return active;
- }
- void Space2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_active", "active"), &Space2D::set_active);
- ClassDB::bind_method(D_METHOD("is_active"), &Space2D::is_active);
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "active"), "set_active", "is_active");
- }
- Space2D::Space2D() {
- active = false;
- space = Physics2DServer::get_singleton()->space_create();
- }
- Space2D::~Space2D() {
- Physics2DServer::get_singleton()->free(space);
- }
|