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