1 /** 2 Parameters to be sent to a 2D shape physics query. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.physics2dshapequeryparameters; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.reference; 24 import godot.resource; 25 /** 26 Parameters to be sent to a 2D shape physics query. 27 28 This class contains the shape and other parameters for intersection/collision queries. 29 */ 30 @GodotBaseClass struct Physics2DShapeQueryParameters 31 { 32 enum string _GODOT_internal_name = "Physics2DShapeQueryParameters"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Reference _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct _classBinding 40 { 41 __gshared: 42 @GodotName("set_shape") GodotMethod!(void, Resource) setShape; 43 @GodotName("set_shape_rid") GodotMethod!(void, RID) setShapeRid; 44 @GodotName("get_shape_rid") GodotMethod!(RID) getShapeRid; 45 @GodotName("set_transform") GodotMethod!(void, Transform2D) setTransform; 46 @GodotName("get_transform") GodotMethod!(Transform2D) getTransform; 47 @GodotName("set_motion") GodotMethod!(void, Vector2) setMotion; 48 @GodotName("get_motion") GodotMethod!(Vector2) getMotion; 49 @GodotName("set_margin") GodotMethod!(void, double) setMargin; 50 @GodotName("get_margin") GodotMethod!(double) getMargin; 51 @GodotName("set_collision_layer") GodotMethod!(void, long) setCollisionLayer; 52 @GodotName("get_collision_layer") GodotMethod!(long) getCollisionLayer; 53 @GodotName("set_exclude") GodotMethod!(void, Array) setExclude; 54 @GodotName("get_exclude") GodotMethod!(Array) getExclude; 55 @GodotName("set_collide_with_bodies") GodotMethod!(void, bool) setCollideWithBodies; 56 @GodotName("is_collide_with_bodies_enabled") GodotMethod!(bool) isCollideWithBodiesEnabled; 57 @GodotName("set_collide_with_areas") GodotMethod!(void, bool) setCollideWithAreas; 58 @GodotName("is_collide_with_areas_enabled") GodotMethod!(bool) isCollideWithAreasEnabled; 59 } 60 bool opEquals(in Physics2DShapeQueryParameters other) const { return _godot_object.ptr is other._godot_object.ptr; } 61 Physics2DShapeQueryParameters opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 62 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 63 mixin baseCasts; 64 static Physics2DShapeQueryParameters _new() 65 { 66 static godot_class_constructor constructor; 67 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Physics2DShapeQueryParameters"); 68 if(constructor is null) return typeof(this).init; 69 return cast(Physics2DShapeQueryParameters)(constructor()); 70 } 71 @disable new(size_t s); 72 /** 73 Set the $(D Shape2D) that will be used for collision/intersection queries. 74 */ 75 void setShape(Resource shape) 76 { 77 checkClassBinding!(typeof(this))(); 78 ptrcall!(void)(_classBinding.setShape, _godot_object, shape); 79 } 80 /** 81 82 */ 83 void setShapeRid(in RID shape) 84 { 85 checkClassBinding!(typeof(this))(); 86 ptrcall!(void)(_classBinding.setShapeRid, _godot_object, shape); 87 } 88 /** 89 90 */ 91 RID getShapeRid() const 92 { 93 checkClassBinding!(typeof(this))(); 94 return ptrcall!(RID)(_classBinding.getShapeRid, _godot_object); 95 } 96 /** 97 98 */ 99 void setTransform(in Transform2D transform) 100 { 101 checkClassBinding!(typeof(this))(); 102 ptrcall!(void)(_classBinding.setTransform, _godot_object, transform); 103 } 104 /** 105 106 */ 107 Transform2D getTransform() const 108 { 109 checkClassBinding!(typeof(this))(); 110 return ptrcall!(Transform2D)(_classBinding.getTransform, _godot_object); 111 } 112 /** 113 114 */ 115 void setMotion(in Vector2 motion) 116 { 117 checkClassBinding!(typeof(this))(); 118 ptrcall!(void)(_classBinding.setMotion, _godot_object, motion); 119 } 120 /** 121 122 */ 123 Vector2 getMotion() const 124 { 125 checkClassBinding!(typeof(this))(); 126 return ptrcall!(Vector2)(_classBinding.getMotion, _godot_object); 127 } 128 /** 129 130 */ 131 void setMargin(in double margin) 132 { 133 checkClassBinding!(typeof(this))(); 134 ptrcall!(void)(_classBinding.setMargin, _godot_object, margin); 135 } 136 /** 137 138 */ 139 double getMargin() const 140 { 141 checkClassBinding!(typeof(this))(); 142 return ptrcall!(double)(_classBinding.getMargin, _godot_object); 143 } 144 /** 145 146 */ 147 void setCollisionLayer(in long collision_layer) 148 { 149 checkClassBinding!(typeof(this))(); 150 ptrcall!(void)(_classBinding.setCollisionLayer, _godot_object, collision_layer); 151 } 152 /** 153 154 */ 155 long getCollisionLayer() const 156 { 157 checkClassBinding!(typeof(this))(); 158 return ptrcall!(long)(_classBinding.getCollisionLayer, _godot_object); 159 } 160 /** 161 162 */ 163 void setExclude(in Array exclude) 164 { 165 checkClassBinding!(typeof(this))(); 166 ptrcall!(void)(_classBinding.setExclude, _godot_object, exclude); 167 } 168 /** 169 170 */ 171 Array getExclude() const 172 { 173 checkClassBinding!(typeof(this))(); 174 return ptrcall!(Array)(_classBinding.getExclude, _godot_object); 175 } 176 /** 177 178 */ 179 void setCollideWithBodies(in bool enable) 180 { 181 checkClassBinding!(typeof(this))(); 182 ptrcall!(void)(_classBinding.setCollideWithBodies, _godot_object, enable); 183 } 184 /** 185 186 */ 187 bool isCollideWithBodiesEnabled() const 188 { 189 checkClassBinding!(typeof(this))(); 190 return ptrcall!(bool)(_classBinding.isCollideWithBodiesEnabled, _godot_object); 191 } 192 /** 193 194 */ 195 void setCollideWithAreas(in bool enable) 196 { 197 checkClassBinding!(typeof(this))(); 198 ptrcall!(void)(_classBinding.setCollideWithAreas, _godot_object, enable); 199 } 200 /** 201 202 */ 203 bool isCollideWithAreasEnabled() const 204 { 205 checkClassBinding!(typeof(this))(); 206 return ptrcall!(bool)(_classBinding.isCollideWithAreasEnabled, _godot_object); 207 } 208 /** 209 The physics layer the query should be made on. 210 */ 211 @property long collisionLayer() 212 { 213 return getCollisionLayer(); 214 } 215 /// ditto 216 @property void collisionLayer(long v) 217 { 218 setCollisionLayer(v); 219 } 220 /** 221 The list of objects or object $(D RID)s, that will be excluded from collisions. 222 */ 223 @property Array exclude() 224 { 225 return getExclude(); 226 } 227 /// ditto 228 @property void exclude(Array v) 229 { 230 setExclude(v); 231 } 232 /** 233 The collision margin for the shape. 234 */ 235 @property double margin() 236 { 237 return getMargin(); 238 } 239 /// ditto 240 @property void margin(double v) 241 { 242 setMargin(v); 243 } 244 /** 245 The motion of the shape being queried for. 246 */ 247 @property Vector2 motion() 248 { 249 return getMotion(); 250 } 251 /// ditto 252 @property void motion(Vector2 v) 253 { 254 setMotion(v); 255 } 256 /** 257 The $(D RID) of the queried shape. See $(D setShape) also. 258 */ 259 @property RID shapeRid() 260 { 261 return getShapeRid(); 262 } 263 /// ditto 264 @property void shapeRid(RID v) 265 { 266 setShapeRid(v); 267 } 268 /** 269 the transform matrix of the queried shape. 270 */ 271 @property Transform2D transform() 272 { 273 return getTransform(); 274 } 275 /// ditto 276 @property void transform(Transform2D v) 277 { 278 setTransform(v); 279 } 280 /** 281 282 */ 283 @property bool collideWithBodies() 284 { 285 return isCollideWithBodiesEnabled(); 286 } 287 /// ditto 288 @property void collideWithBodies(bool v) 289 { 290 setCollideWithBodies(v); 291 } 292 /** 293 294 */ 295 @property bool collideWithAreas() 296 { 297 return isCollideWithAreasEnabled(); 298 } 299 /// ditto 300 @property void collideWithAreas(bool v) 301 { 302 setCollideWithAreas(v); 303 } 304 }