1 /** 2 Convex Polygon Shape for 2D physics. 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.convexpolygonshape2d; 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.shape2d; 24 import godot.resource; 25 import godot.reference; 26 /** 27 Convex Polygon Shape for 2D physics. 28 29 A convex polygon, whatever its shape, is internally decomposed into as many convex polygons as needed to ensure all collision checks against it are always done on convex polygons (which are faster to check). 30 The main difference between a `ConvexPolygonShape2D` and a $(D ConcavePolygonShape2D) is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. 31 */ 32 @GodotBaseClass struct ConvexPolygonShape2D 33 { 34 enum string _GODOT_internal_name = "ConvexPolygonShape2D"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; Shape2D _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct _classBinding 42 { 43 __gshared: 44 @GodotName("set_point_cloud") GodotMethod!(void, PoolVector2Array) setPointCloud; 45 @GodotName("set_points") GodotMethod!(void, PoolVector2Array) setPoints; 46 @GodotName("get_points") GodotMethod!(PoolVector2Array) getPoints; 47 } 48 bool opEquals(in ConvexPolygonShape2D other) const { return _godot_object.ptr is other._godot_object.ptr; } 49 ConvexPolygonShape2D opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 50 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 51 mixin baseCasts; 52 static ConvexPolygonShape2D _new() 53 { 54 static godot_class_constructor constructor; 55 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ConvexPolygonShape2D"); 56 if(constructor is null) return typeof(this).init; 57 return cast(ConvexPolygonShape2D)(constructor()); 58 } 59 @disable new(size_t s); 60 /** 61 Currently, this method does nothing. 62 */ 63 void setPointCloud(in PoolVector2Array point_cloud) 64 { 65 checkClassBinding!(typeof(this))(); 66 ptrcall!(void)(_classBinding.setPointCloud, _godot_object, point_cloud); 67 } 68 /** 69 70 */ 71 void setPoints(in PoolVector2Array points) 72 { 73 checkClassBinding!(typeof(this))(); 74 ptrcall!(void)(_classBinding.setPoints, _godot_object, points); 75 } 76 /** 77 78 */ 79 PoolVector2Array getPoints() const 80 { 81 checkClassBinding!(typeof(this))(); 82 return ptrcall!(PoolVector2Array)(_classBinding.getPoints, _godot_object); 83 } 84 /** 85 The polygon's list of vertices. Can be in either clockwise or counterclockwise order. 86 */ 87 @property PoolVector2Array points() 88 { 89 return getPoints(); 90 } 91 /// ditto 92 @property void points(PoolVector2Array v) 93 { 94 setPoints(v); 95 } 96 }