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