1 /**
2 Defines a 2D polygon for LightOccluder2D.
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.occluderpolygon2d;
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 Defines a 2D polygon for LightOccluder2D.
27 
28 Editor facility that helps you draw a 2D polygon used as resource for $(D LightOccluder2D).
29 */
30 @GodotBaseClass struct OccluderPolygon2D
31 {
32 	package(godot) enum string _GODOT_internal_name = "OccluderPolygon2D";
33 public:
34 @nogc nothrow:
35 	union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; }
36 	alias _GODOT_base this;
37 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
38 	package(godot) __gshared bool _classBindingInitialized = false;
39 	package(godot) static struct GDNativeClassBinding
40 	{
41 		__gshared:
42 		@GodotName("get_cull_mode") GodotMethod!(OccluderPolygon2D.CullMode) getCullMode;
43 		@GodotName("get_polygon") GodotMethod!(PoolVector2Array) getPolygon;
44 		@GodotName("is_closed") GodotMethod!(bool) isClosed;
45 		@GodotName("set_closed") GodotMethod!(void, bool) setClosed;
46 		@GodotName("set_cull_mode") GodotMethod!(void, long) setCullMode;
47 		@GodotName("set_polygon") GodotMethod!(void, PoolVector2Array) setPolygon;
48 	}
49 	/// 
50 	pragma(inline, true) bool opEquals(in OccluderPolygon2D other) const
51 	{ return _godot_object.ptr is other._godot_object.ptr; }
52 	/// 
53 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
54 	{ _godot_object.ptr = n; return null; }
55 	/// 
56 	pragma(inline, true) bool opEquals(typeof(null) n) const
57 	{ return _godot_object.ptr is n; }
58 	/// 
59 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
60 	mixin baseCasts;
61 	/// Construct a new instance of OccluderPolygon2D.
62 	/// Note: use `memnew!OccluderPolygon2D` instead.
63 	static OccluderPolygon2D _new()
64 	{
65 		static godot_class_constructor constructor;
66 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("OccluderPolygon2D");
67 		if(constructor is null) return typeof(this).init;
68 		return cast(OccluderPolygon2D)(constructor());
69 	}
70 	@disable new(size_t s);
71 	/// 
72 	enum CullMode : int
73 	{
74 		/**
75 		Culling is disabled. See $(D cullMode).
76 		*/
77 		cullDisabled = 0,
78 		/**
79 		Culling is performed in the clockwise direction. See $(D cullMode).
80 		*/
81 		cullClockwise = 1,
82 		/**
83 		Culling is performed in the counterclockwise direction. See $(D cullMode).
84 		*/
85 		cullCounterClockwise = 2,
86 	}
87 	/// 
88 	enum Constants : int
89 	{
90 		cullDisabled = 0,
91 		cullClockwise = 1,
92 		cullCounterClockwise = 2,
93 	}
94 	/**
95 	
96 	*/
97 	OccluderPolygon2D.CullMode getCullMode() const
98 	{
99 		checkClassBinding!(typeof(this))();
100 		return ptrcall!(OccluderPolygon2D.CullMode)(GDNativeClassBinding.getCullMode, _godot_object);
101 	}
102 	/**
103 	
104 	*/
105 	PoolVector2Array getPolygon() const
106 	{
107 		checkClassBinding!(typeof(this))();
108 		return ptrcall!(PoolVector2Array)(GDNativeClassBinding.getPolygon, _godot_object);
109 	}
110 	/**
111 	
112 	*/
113 	bool isClosed() const
114 	{
115 		checkClassBinding!(typeof(this))();
116 		return ptrcall!(bool)(GDNativeClassBinding.isClosed, _godot_object);
117 	}
118 	/**
119 	
120 	*/
121 	void setClosed(in bool closed)
122 	{
123 		checkClassBinding!(typeof(this))();
124 		ptrcall!(void)(GDNativeClassBinding.setClosed, _godot_object, closed);
125 	}
126 	/**
127 	
128 	*/
129 	void setCullMode(in long cull_mode)
130 	{
131 		checkClassBinding!(typeof(this))();
132 		ptrcall!(void)(GDNativeClassBinding.setCullMode, _godot_object, cull_mode);
133 	}
134 	/**
135 	
136 	*/
137 	void setPolygon(in PoolVector2Array polygon)
138 	{
139 		checkClassBinding!(typeof(this))();
140 		ptrcall!(void)(GDNativeClassBinding.setPolygon, _godot_object, polygon);
141 	}
142 	/**
143 	If `true`, closes the polygon. A closed OccluderPolygon2D occludes the light coming from any direction. An opened OccluderPolygon2D occludes the light only at its outline's direction.
144 	*/
145 	@property bool closed()
146 	{
147 		return isClosed();
148 	}
149 	/// ditto
150 	@property void closed(bool v)
151 	{
152 		setClosed(v);
153 	}
154 	/**
155 	The culling mode to use.
156 	*/
157 	@property OccluderPolygon2D.CullMode cullMode()
158 	{
159 		return getCullMode();
160 	}
161 	/// ditto
162 	@property void cullMode(long v)
163 	{
164 		setCullMode(v);
165 	}
166 	/**
167 	A $(D Vector2) array with the index for polygon's vertices positions.
168 	$(B Note:) The returned value is a copy of the underlying array, rather than a reference.
169 	*/
170 	@property PoolVector2Array polygon()
171 	{
172 		return getPolygon();
173 	}
174 	/// ditto
175 	@property void polygon(PoolVector2Array v)
176 	{
177 		setPolygon(v);
178 	}
179 }