1 /**
2 A material for physics properties.
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.physicsmaterial;
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.resource;
24 import godot.reference;
25 /**
26 A material for physics properties.
27 
28 Provides a means of modifying the collision properties of a $(D PhysicsBody).
29 */
30 @GodotBaseClass struct PhysicsMaterial
31 {
32 	enum string _GODOT_internal_name = "PhysicsMaterial";
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 _classBinding
40 	{
41 		__gshared:
42 		@GodotName("set_friction") GodotMethod!(void, double) setFriction;
43 		@GodotName("get_friction") GodotMethod!(double) getFriction;
44 		@GodotName("set_rough") GodotMethod!(void, bool) setRough;
45 		@GodotName("is_rough") GodotMethod!(bool) isRough;
46 		@GodotName("set_bounce") GodotMethod!(void, double) setBounce;
47 		@GodotName("get_bounce") GodotMethod!(double) getBounce;
48 		@GodotName("set_absorbent") GodotMethod!(void, bool) setAbsorbent;
49 		@GodotName("is_absorbent") GodotMethod!(bool) isAbsorbent;
50 	}
51 	bool opEquals(in PhysicsMaterial other) const { return _godot_object.ptr is other._godot_object.ptr; }
52 	PhysicsMaterial opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
53 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
54 	mixin baseCasts;
55 	static PhysicsMaterial _new()
56 	{
57 		static godot_class_constructor constructor;
58 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PhysicsMaterial");
59 		if(constructor is null) return typeof(this).init;
60 		return cast(PhysicsMaterial)(constructor());
61 	}
62 	@disable new(size_t s);
63 	/**
64 	
65 	*/
66 	void setFriction(in double friction)
67 	{
68 		checkClassBinding!(typeof(this))();
69 		ptrcall!(void)(_classBinding.setFriction, _godot_object, friction);
70 	}
71 	/**
72 	
73 	*/
74 	double getFriction() const
75 	{
76 		checkClassBinding!(typeof(this))();
77 		return ptrcall!(double)(_classBinding.getFriction, _godot_object);
78 	}
79 	/**
80 	
81 	*/
82 	void setRough(in bool rough)
83 	{
84 		checkClassBinding!(typeof(this))();
85 		ptrcall!(void)(_classBinding.setRough, _godot_object, rough);
86 	}
87 	/**
88 	
89 	*/
90 	bool isRough() const
91 	{
92 		checkClassBinding!(typeof(this))();
93 		return ptrcall!(bool)(_classBinding.isRough, _godot_object);
94 	}
95 	/**
96 	
97 	*/
98 	void setBounce(in double bounce)
99 	{
100 		checkClassBinding!(typeof(this))();
101 		ptrcall!(void)(_classBinding.setBounce, _godot_object, bounce);
102 	}
103 	/**
104 	
105 	*/
106 	double getBounce() const
107 	{
108 		checkClassBinding!(typeof(this))();
109 		return ptrcall!(double)(_classBinding.getBounce, _godot_object);
110 	}
111 	/**
112 	
113 	*/
114 	void setAbsorbent(in bool absorbent)
115 	{
116 		checkClassBinding!(typeof(this))();
117 		ptrcall!(void)(_classBinding.setAbsorbent, _godot_object, absorbent);
118 	}
119 	/**
120 	
121 	*/
122 	bool isAbsorbent() const
123 	{
124 		checkClassBinding!(typeof(this))();
125 		return ptrcall!(bool)(_classBinding.isAbsorbent, _godot_object);
126 	}
127 	/**
128 	The body's friction. Values range from `0` (frictionless) to `1` (maximum friction). Default value: `1`.
129 	*/
130 	@property double friction()
131 	{
132 		return getFriction();
133 	}
134 	/// ditto
135 	@property void friction(double v)
136 	{
137 		setFriction(v);
138 	}
139 	/**
140 	
141 	*/
142 	@property bool rough()
143 	{
144 		return isRough();
145 	}
146 	/// ditto
147 	@property void rough(bool v)
148 	{
149 		setRough(v);
150 	}
151 	/**
152 	The body's bounciness. Default value: `0`.
153 	*/
154 	@property double bounce()
155 	{
156 		return getBounce();
157 	}
158 	/// ditto
159 	@property void bounce(double v)
160 	{
161 		setBounce(v);
162 	}
163 	/**
164 	
165 	*/
166 	@property bool absorbent()
167 	{
168 		return isAbsorbent();
169 	}
170 	/// ditto
171 	@property void absorbent(bool v)
172 	{
173 		setAbsorbent(v);
174 	}
175 }