1 /** 2 $(I Deprecated.) Camera which moves toward another node. 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.interpolatedcamera; 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.camera; 25 import godot.spatial; 26 /** 27 $(I Deprecated.) Camera which moves toward another node. 28 29 $(I Deprecated (will be removed in Godot 4.0).) InterpolatedCamera is a $(D Camera) which smoothly moves to match a target node's position and rotation. 30 If it is not $(D enabled) or does not have a valid target set, InterpolatedCamera acts like a normal Camera. 31 */ 32 @GodotBaseClass struct InterpolatedCamera 33 { 34 package(godot) enum string _GODOT_internal_name = "InterpolatedCamera"; 35 public: 36 @nogc nothrow: 37 union { /** */ godot_object _godot_object; /** */ Camera _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct GDNativeClassBinding 42 { 43 __gshared: 44 @GodotName("get_speed") GodotMethod!(double) getSpeed; 45 @GodotName("get_target_path") GodotMethod!(NodePath) getTargetPath; 46 @GodotName("is_interpolation_enabled") GodotMethod!(bool) isInterpolationEnabled; 47 @GodotName("set_interpolation_enabled") GodotMethod!(void, bool) setInterpolationEnabled; 48 @GodotName("set_speed") GodotMethod!(void, double) setSpeed; 49 @GodotName("set_target") GodotMethod!(void, GodotObject) setTarget; 50 @GodotName("set_target_path") GodotMethod!(void, NodePath) setTargetPath; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in InterpolatedCamera other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of InterpolatedCamera. 65 /// Note: use `memnew!InterpolatedCamera` instead. 66 static InterpolatedCamera _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InterpolatedCamera"); 70 if(constructor is null) return typeof(this).init; 71 return cast(InterpolatedCamera)(constructor()); 72 } 73 @disable new(size_t s); 74 /** 75 76 */ 77 double getSpeed() const 78 { 79 checkClassBinding!(typeof(this))(); 80 return ptrcall!(double)(GDNativeClassBinding.getSpeed, _godot_object); 81 } 82 /** 83 84 */ 85 NodePath getTargetPath() const 86 { 87 checkClassBinding!(typeof(this))(); 88 return ptrcall!(NodePath)(GDNativeClassBinding.getTargetPath, _godot_object); 89 } 90 /** 91 92 */ 93 bool isInterpolationEnabled() const 94 { 95 checkClassBinding!(typeof(this))(); 96 return ptrcall!(bool)(GDNativeClassBinding.isInterpolationEnabled, _godot_object); 97 } 98 /** 99 100 */ 101 void setInterpolationEnabled(in bool target_path) 102 { 103 checkClassBinding!(typeof(this))(); 104 ptrcall!(void)(GDNativeClassBinding.setInterpolationEnabled, _godot_object, target_path); 105 } 106 /** 107 108 */ 109 void setSpeed(in double speed) 110 { 111 checkClassBinding!(typeof(this))(); 112 ptrcall!(void)(GDNativeClassBinding.setSpeed, _godot_object, speed); 113 } 114 /** 115 Sets the node to move toward and orient with. 116 */ 117 void setTarget(GodotObject target) 118 { 119 checkClassBinding!(typeof(this))(); 120 ptrcall!(void)(GDNativeClassBinding.setTarget, _godot_object, target); 121 } 122 /** 123 124 */ 125 void setTargetPath(NodePathArg0)(in NodePathArg0 target_path) 126 { 127 checkClassBinding!(typeof(this))(); 128 ptrcall!(void)(GDNativeClassBinding.setTargetPath, _godot_object, target_path); 129 } 130 /** 131 If `true`, and a target is set, the camera will move automatically. 132 */ 133 @property bool enabled() 134 { 135 return isInterpolationEnabled(); 136 } 137 /// ditto 138 @property void enabled(bool v) 139 { 140 setInterpolationEnabled(v); 141 } 142 /** 143 How quickly the camera moves toward its target. Higher values will result in tighter camera motion. 144 */ 145 @property double speed() 146 { 147 return getSpeed(); 148 } 149 /// ditto 150 @property void speed(double v) 151 { 152 setSpeed(v); 153 } 154 /** 155 The target's $(D NodePath). 156 */ 157 @property NodePath target() 158 { 159 return getTargetPath(); 160 } 161 /// ditto 162 @property void target(NodePath v) 163 { 164 setTargetPath(v); 165 } 166 }