1 /**
2 A parallax scrolling layer to be used with $(D ParallaxBackground).
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.parallaxlayer;
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.node2d;
25 import godot.canvasitem;
26 import godot.node;
27 /**
28 A parallax scrolling layer to be used with $(D ParallaxBackground).
29 
30 A ParallaxLayer must be the child of a $(D ParallaxBackground) node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the $(D ParallaxBackground.scrollOffset) value.
31 This node's children will be affected by its scroll offset.
32 $(B Note:) Any changes to this node's position and scale made after it enters the scene will be ignored.
33 */
34 @GodotBaseClass struct ParallaxLayer
35 {
36 	package(godot) enum string _GODOT_internal_name = "ParallaxLayer";
37 public:
38 @nogc nothrow:
39 	union { /** */ godot_object _godot_object; /** */ Node2D _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_mirroring") GodotMethod!(Vector2) getMirroring;
47 		@GodotName("get_motion_offset") GodotMethod!(Vector2) getMotionOffset;
48 		@GodotName("get_motion_scale") GodotMethod!(Vector2) getMotionScale;
49 		@GodotName("set_mirroring") GodotMethod!(void, Vector2) setMirroring;
50 		@GodotName("set_motion_offset") GodotMethod!(void, Vector2) setMotionOffset;
51 		@GodotName("set_motion_scale") GodotMethod!(void, Vector2) setMotionScale;
52 	}
53 	/// 
54 	pragma(inline, true) bool opEquals(in ParallaxLayer other) const
55 	{ return _godot_object.ptr is other._godot_object.ptr; }
56 	/// 
57 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
58 	{ _godot_object.ptr = n; return null; }
59 	/// 
60 	pragma(inline, true) bool opEquals(typeof(null) n) const
61 	{ return _godot_object.ptr is n; }
62 	/// 
63 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
64 	mixin baseCasts;
65 	/// Construct a new instance of ParallaxLayer.
66 	/// Note: use `memnew!ParallaxLayer` instead.
67 	static ParallaxLayer _new()
68 	{
69 		static godot_class_constructor constructor;
70 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ParallaxLayer");
71 		if(constructor is null) return typeof(this).init;
72 		return cast(ParallaxLayer)(constructor());
73 	}
74 	@disable new(size_t s);
75 	/**
76 	
77 	*/
78 	Vector2 getMirroring() const
79 	{
80 		checkClassBinding!(typeof(this))();
81 		return ptrcall!(Vector2)(GDNativeClassBinding.getMirroring, _godot_object);
82 	}
83 	/**
84 	
85 	*/
86 	Vector2 getMotionOffset() const
87 	{
88 		checkClassBinding!(typeof(this))();
89 		return ptrcall!(Vector2)(GDNativeClassBinding.getMotionOffset, _godot_object);
90 	}
91 	/**
92 	
93 	*/
94 	Vector2 getMotionScale() const
95 	{
96 		checkClassBinding!(typeof(this))();
97 		return ptrcall!(Vector2)(GDNativeClassBinding.getMotionScale, _godot_object);
98 	}
99 	/**
100 	
101 	*/
102 	void setMirroring(in Vector2 mirror)
103 	{
104 		checkClassBinding!(typeof(this))();
105 		ptrcall!(void)(GDNativeClassBinding.setMirroring, _godot_object, mirror);
106 	}
107 	/**
108 	
109 	*/
110 	void setMotionOffset(in Vector2 offset)
111 	{
112 		checkClassBinding!(typeof(this))();
113 		ptrcall!(void)(GDNativeClassBinding.setMotionOffset, _godot_object, offset);
114 	}
115 	/**
116 	
117 	*/
118 	void setMotionScale(in Vector2 scale)
119 	{
120 		checkClassBinding!(typeof(this))();
121 		ptrcall!(void)(GDNativeClassBinding.setMotionScale, _godot_object, scale);
122 	}
123 	/**
124 	The ParallaxLayer's $(D Texture) mirroring. Useful for creating an infinite scrolling background. If an axis is set to `0`, the $(D Texture) will not be mirrored.
125 	*/
126 	@property Vector2 motionMirroring()
127 	{
128 		return getMirroring();
129 	}
130 	/// ditto
131 	@property void motionMirroring(Vector2 v)
132 	{
133 		setMirroring(v);
134 	}
135 	/**
136 	The ParallaxLayer's offset relative to the parent ParallaxBackground's $(D ParallaxBackground.scrollOffset).
137 	*/
138 	@property Vector2 motionOffset()
139 	{
140 		return getMotionOffset();
141 	}
142 	/// ditto
143 	@property void motionOffset(Vector2 v)
144 	{
145 		setMotionOffset(v);
146 	}
147 	/**
148 	Multiplies the ParallaxLayer's motion. If an axis is set to `0`, it will not scroll.
149 	*/
150 	@property Vector2 motionScale()
151 	{
152 		return getMotionScale();
153 	}
154 	/// ditto
155 	@property void motionScale(Vector2 v)
156 	{
157 		setMotionScale(v);
158 	}
159 }