1 /** 2 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.polygonpathfinder; 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.resource; 25 /** 26 27 */ 28 @GodotBaseClass struct PolygonPathFinder 29 { 30 package(godot) enum string _GODOT_internal_name = "PolygonPathFinder"; 31 public: 32 @nogc nothrow: 33 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct GDNativeClassBinding 38 { 39 __gshared: 40 @GodotName("_get_data") GodotMethod!(Dictionary) _getData; 41 @GodotName("_set_data") GodotMethod!(void, Dictionary) _setData; 42 @GodotName("find_path") GodotMethod!(PoolVector2Array, Vector2, Vector2) findPath; 43 @GodotName("get_bounds") GodotMethod!(Rect2) getBounds; 44 @GodotName("get_closest_point") GodotMethod!(Vector2, Vector2) getClosestPoint; 45 @GodotName("get_intersections") GodotMethod!(PoolVector2Array, Vector2, Vector2) getIntersections; 46 @GodotName("get_point_penalty") GodotMethod!(double, long) getPointPenalty; 47 @GodotName("is_point_inside") GodotMethod!(bool, Vector2) isPointInside; 48 @GodotName("set_point_penalty") GodotMethod!(void, long, double) setPointPenalty; 49 @GodotName("setup") GodotMethod!(void, PoolVector2Array, PoolIntArray) setup; 50 } 51 /// 52 pragma(inline, true) bool opEquals(in PolygonPathFinder other) const 53 { return _godot_object.ptr is other._godot_object.ptr; } 54 /// 55 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 56 { _godot_object.ptr = n; return null; } 57 /// 58 pragma(inline, true) bool opEquals(typeof(null) n) const 59 { return _godot_object.ptr is n; } 60 /// 61 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 62 mixin baseCasts; 63 /// Construct a new instance of PolygonPathFinder. 64 /// Note: use `memnew!PolygonPathFinder` instead. 65 static PolygonPathFinder _new() 66 { 67 static godot_class_constructor constructor; 68 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PolygonPathFinder"); 69 if(constructor is null) return typeof(this).init; 70 return cast(PolygonPathFinder)(constructor()); 71 } 72 @disable new(size_t s); 73 /** 74 75 */ 76 Dictionary _getData() const 77 { 78 Array _GODOT_args = Array.make(); 79 String _GODOT_method_name = String("_get_data"); 80 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Dictionary); 81 } 82 /** 83 84 */ 85 void _setData(in Dictionary arg0) 86 { 87 Array _GODOT_args = Array.make(); 88 _GODOT_args.append(arg0); 89 String _GODOT_method_name = String("_set_data"); 90 this.callv(_GODOT_method_name, _GODOT_args); 91 } 92 /** 93 94 */ 95 PoolVector2Array findPath(in Vector2 from, in Vector2 to) 96 { 97 checkClassBinding!(typeof(this))(); 98 return ptrcall!(PoolVector2Array)(GDNativeClassBinding.findPath, _godot_object, from, to); 99 } 100 /** 101 102 */ 103 Rect2 getBounds() const 104 { 105 checkClassBinding!(typeof(this))(); 106 return ptrcall!(Rect2)(GDNativeClassBinding.getBounds, _godot_object); 107 } 108 /** 109 110 */ 111 Vector2 getClosestPoint(in Vector2 point) const 112 { 113 checkClassBinding!(typeof(this))(); 114 return ptrcall!(Vector2)(GDNativeClassBinding.getClosestPoint, _godot_object, point); 115 } 116 /** 117 118 */ 119 PoolVector2Array getIntersections(in Vector2 from, in Vector2 to) const 120 { 121 checkClassBinding!(typeof(this))(); 122 return ptrcall!(PoolVector2Array)(GDNativeClassBinding.getIntersections, _godot_object, from, to); 123 } 124 /** 125 126 */ 127 double getPointPenalty(in long idx) const 128 { 129 checkClassBinding!(typeof(this))(); 130 return ptrcall!(double)(GDNativeClassBinding.getPointPenalty, _godot_object, idx); 131 } 132 /** 133 134 */ 135 bool isPointInside(in Vector2 point) const 136 { 137 checkClassBinding!(typeof(this))(); 138 return ptrcall!(bool)(GDNativeClassBinding.isPointInside, _godot_object, point); 139 } 140 /** 141 142 */ 143 void setPointPenalty(in long idx, in double penalty) 144 { 145 checkClassBinding!(typeof(this))(); 146 ptrcall!(void)(GDNativeClassBinding.setPointPenalty, _godot_object, idx, penalty); 147 } 148 /** 149 150 */ 151 void setup(in PoolVector2Array points, in PoolIntArray connections) 152 { 153 checkClassBinding!(typeof(this))(); 154 ptrcall!(void)(GDNativeClassBinding.setup, _godot_object, points, connections); 155 } 156 /** 157 158 */ 159 @property Dictionary data() 160 { 161 return _getData(); 162 } 163 /// ditto 164 @property void data(Dictionary v) 165 { 166 _setData(v); 167 } 168 }