1 /**
2 Commonly used mathematical constants.
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.visualscriptmathconstant;
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.visualscriptnode;
24 import godot.resource;
25 import godot.reference;
26 /**
27 Commonly used mathematical constants.
28 
29 Provides common math constants, such as Pi, on an output Data port.
30 $(B Input Ports:)
31 none
32 $(B Output Ports:)
33 - Data (variant): `get`
34 */
35 @GodotBaseClass struct VisualScriptMathConstant
36 {
37 	enum string _GODOT_internal_name = "VisualScriptMathConstant";
38 public:
39 @nogc nothrow:
40 	union { godot_object _godot_object; VisualScriptNode _GODOT_base; }
41 	alias _GODOT_base this;
42 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
43 	package(godot) __gshared bool _classBindingInitialized = false;
44 	package(godot) static struct _classBinding
45 	{
46 		__gshared:
47 		@GodotName("set_math_constant") GodotMethod!(void, long) setMathConstant;
48 		@GodotName("get_math_constant") GodotMethod!(VisualScriptMathConstant.MathConstant) getMathConstant;
49 	}
50 	bool opEquals(in VisualScriptMathConstant other) const { return _godot_object.ptr is other._godot_object.ptr; }
51 	VisualScriptMathConstant opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
52 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
53 	mixin baseCasts;
54 	static VisualScriptMathConstant _new()
55 	{
56 		static godot_class_constructor constructor;
57 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptMathConstant");
58 		if(constructor is null) return typeof(this).init;
59 		return cast(VisualScriptMathConstant)(constructor());
60 	}
61 	@disable new(size_t s);
62 	/// 
63 	enum MathConstant : int
64 	{
65 		/**
66 		Unity: `1`
67 		*/
68 		mathConstantOne = 0,
69 		/**
70 		Pi: `3.141593`
71 		*/
72 		mathConstantPi = 1,
73 		/**
74 		Pi divided by two: `1.570796`
75 		*/
76 		mathConstantHalfPi = 2,
77 		/**
78 		Tau: `6.283185`
79 		*/
80 		mathConstantTau = 3,
81 		/**
82 		Mathematical constant `e`, the natural log base: `2.718282`
83 		*/
84 		mathConstantE = 4,
85 		/**
86 		Square root of two: `1.414214`
87 		*/
88 		mathConstantSqrt2 = 5,
89 		/**
90 		Infinity: `inf`
91 		*/
92 		mathConstantInf = 6,
93 		/**
94 		Not a number: `nan`
95 		*/
96 		mathConstantNan = 7,
97 		/**
98 		
99 		*/
100 		mathConstantMax = 8,
101 	}
102 	/// 
103 	enum Constants : int
104 	{
105 		mathConstantOne = 0,
106 		mathConstantPi = 1,
107 		mathConstantHalfPi = 2,
108 		mathConstantTau = 3,
109 		mathConstantE = 4,
110 		mathConstantSqrt2 = 5,
111 		mathConstantInf = 6,
112 		mathConstantNan = 7,
113 		mathConstantMax = 8,
114 	}
115 	/**
116 	
117 	*/
118 	void setMathConstant(in long which)
119 	{
120 		checkClassBinding!(typeof(this))();
121 		ptrcall!(void)(_classBinding.setMathConstant, _godot_object, which);
122 	}
123 	/**
124 	
125 	*/
126 	VisualScriptMathConstant.MathConstant getMathConstant()
127 	{
128 		checkClassBinding!(typeof(this))();
129 		return ptrcall!(VisualScriptMathConstant.MathConstant)(_classBinding.getMathConstant, _godot_object);
130 	}
131 	/**
132 	The math constant.
133 	*/
134 	@property VisualScriptMathConstant.MathConstant constant()
135 	{
136 		return getMathConstant();
137 	}
138 	/// ditto
139 	@property void constant(long v)
140 	{
141 		setMathConstant(v);
142 	}
143 }