1 /** 2 Groove constraint 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.groovejoint2d; 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.joint2d; 24 import godot.node2d; 25 import godot.canvasitem; 26 import godot.node; 27 /** 28 Groove constraint for 2D physics. 29 30 This is useful for making a body "slide" through a segment placed in another. 31 */ 32 @GodotBaseClass struct GrooveJoint2D 33 { 34 enum string _GODOT_internal_name = "GrooveJoint2D"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; Joint2D _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_length") GodotMethod!(void, double) setLength; 45 @GodotName("get_length") GodotMethod!(double) getLength; 46 @GodotName("set_initial_offset") GodotMethod!(void, double) setInitialOffset; 47 @GodotName("get_initial_offset") GodotMethod!(double) getInitialOffset; 48 } 49 bool opEquals(in GrooveJoint2D other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 GrooveJoint2D opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static GrooveJoint2D _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("GrooveJoint2D"); 57 if(constructor is null) return typeof(this).init; 58 return cast(GrooveJoint2D)(constructor()); 59 } 60 @disable new(size_t s); 61 /** 62 63 */ 64 void setLength(in double length) 65 { 66 checkClassBinding!(typeof(this))(); 67 ptrcall!(void)(_classBinding.setLength, _godot_object, length); 68 } 69 /** 70 71 */ 72 double getLength() const 73 { 74 checkClassBinding!(typeof(this))(); 75 return ptrcall!(double)(_classBinding.getLength, _godot_object); 76 } 77 /** 78 79 */ 80 void setInitialOffset(in double offset) 81 { 82 checkClassBinding!(typeof(this))(); 83 ptrcall!(void)(_classBinding.setInitialOffset, _godot_object, offset); 84 } 85 /** 86 87 */ 88 double getInitialOffset() const 89 { 90 checkClassBinding!(typeof(this))(); 91 return ptrcall!(double)(_classBinding.getInitialOffset, _godot_object); 92 } 93 /** 94 The groove's length. The groove is from the joint's origin towards $(D length) along the joint's local y axis. Default value: `50` 95 */ 96 @property double length() 97 { 98 return getLength(); 99 } 100 /// ditto 101 @property void length(double v) 102 { 103 setLength(v); 104 } 105 /** 106 The body B's initial anchor position defined by the joint's origin and a local offset $(D initialOffset) along the joint's y axis (along the groove). Default value: `25` 107 */ 108 @property double initialOffset() 109 { 110 return getInitialOffset(); 111 } 112 /// ditto 113 @property void initialOffset(double v) 114 { 115 setInitialOffset(v); 116 } 117 }