1 /** 2 Pin Joint for 2D shapes. 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.pinjoint2d; 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.joint2d; 25 import godot.node2d; 26 import godot.canvasitem; 27 import godot.node; 28 /** 29 Pin Joint for 2D shapes. 30 31 Pin Joint for 2D rigid bodies. It pins two bodies (rigid or static) together. 32 */ 33 @GodotBaseClass struct PinJoint2D 34 { 35 package(godot) enum string _GODOT_internal_name = "PinJoint2D"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ Joint2D _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("get_softness") GodotMethod!(double) getSoftness; 46 @GodotName("set_softness") GodotMethod!(void, double) setSoftness; 47 } 48 /// 49 pragma(inline, true) bool opEquals(in PinJoint2D other) const 50 { return _godot_object.ptr is other._godot_object.ptr; } 51 /// 52 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 53 { _godot_object.ptr = n; return null; } 54 /// 55 pragma(inline, true) bool opEquals(typeof(null) n) const 56 { return _godot_object.ptr is n; } 57 /// 58 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 59 mixin baseCasts; 60 /// Construct a new instance of PinJoint2D. 61 /// Note: use `memnew!PinJoint2D` instead. 62 static PinJoint2D _new() 63 { 64 static godot_class_constructor constructor; 65 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PinJoint2D"); 66 if(constructor is null) return typeof(this).init; 67 return cast(PinJoint2D)(constructor()); 68 } 69 @disable new(size_t s); 70 /** 71 72 */ 73 double getSoftness() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(double)(GDNativeClassBinding.getSoftness, _godot_object); 77 } 78 /** 79 80 */ 81 void setSoftness(in double softness) 82 { 83 checkClassBinding!(typeof(this))(); 84 ptrcall!(void)(GDNativeClassBinding.setSoftness, _godot_object, softness); 85 } 86 /** 87 The higher this value, the more the bond to the pinned partner can flex. 88 */ 89 @property double softness() 90 { 91 return getSoftness(); 92 } 93 /// ditto 94 @property void softness(double v) 95 { 96 setSoftness(v); 97 } 98 }