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.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.node2d;
24 import godot.canvasitem;
25 import godot.node;
26 /**
27 A parallax scrolling layer to be used with $(D ParallaxBackground).
28 
29 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.
30 This node's children will be affected by its scroll offset.
31 Note that any changes to this node's position and scale made after it enters the scene will be ignored.
32 */
33 @GodotBaseClass struct ParallaxLayer
34 {
35 	enum string _GODOT_internal_name = "ParallaxLayer";
36 public:
37 @nogc nothrow:
38 	union { godot_object _godot_object; Node2D _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct _classBinding
43 	{
44 		__gshared:
45 		@GodotName("set_motion_scale") GodotMethod!(void, Vector2) setMotionScale;
46 		@GodotName("get_motion_scale") GodotMethod!(Vector2) getMotionScale;
47 		@GodotName("set_motion_offset") GodotMethod!(void, Vector2) setMotionOffset;
48 		@GodotName("get_motion_offset") GodotMethod!(Vector2) getMotionOffset;
49 		@GodotName("set_mirroring") GodotMethod!(void, Vector2) setMirroring;
50 		@GodotName("get_mirroring") GodotMethod!(Vector2) getMirroring;
51 	}
52 	bool opEquals(in ParallaxLayer other) const { return _godot_object.ptr is other._godot_object.ptr; }
53 	ParallaxLayer opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
54 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
55 	mixin baseCasts;
56 	static ParallaxLayer _new()
57 	{
58 		static godot_class_constructor constructor;
59 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ParallaxLayer");
60 		if(constructor is null) return typeof(this).init;
61 		return cast(ParallaxLayer)(constructor());
62 	}
63 	@disable new(size_t s);
64 	/**
65 	
66 	*/
67 	void setMotionScale(in Vector2 scale)
68 	{
69 		checkClassBinding!(typeof(this))();
70 		ptrcall!(void)(_classBinding.setMotionScale, _godot_object, scale);
71 	}
72 	/**
73 	
74 	*/
75 	Vector2 getMotionScale() const
76 	{
77 		checkClassBinding!(typeof(this))();
78 		return ptrcall!(Vector2)(_classBinding.getMotionScale, _godot_object);
79 	}
80 	/**
81 	
82 	*/
83 	void setMotionOffset(in Vector2 offset)
84 	{
85 		checkClassBinding!(typeof(this))();
86 		ptrcall!(void)(_classBinding.setMotionOffset, _godot_object, offset);
87 	}
88 	/**
89 	
90 	*/
91 	Vector2 getMotionOffset() const
92 	{
93 		checkClassBinding!(typeof(this))();
94 		return ptrcall!(Vector2)(_classBinding.getMotionOffset, _godot_object);
95 	}
96 	/**
97 	
98 	*/
99 	void setMirroring(in Vector2 mirror)
100 	{
101 		checkClassBinding!(typeof(this))();
102 		ptrcall!(void)(_classBinding.setMirroring, _godot_object, mirror);
103 	}
104 	/**
105 	
106 	*/
107 	Vector2 getMirroring() const
108 	{
109 		checkClassBinding!(typeof(this))();
110 		return ptrcall!(Vector2)(_classBinding.getMirroring, _godot_object);
111 	}
112 	/**
113 	Multiplies the ParallaxLayer's motion. If an axis is set to `0` it will not scroll.
114 	*/
115 	@property Vector2 motionScale()
116 	{
117 		return getMotionScale();
118 	}
119 	/// ditto
120 	@property void motionScale(Vector2 v)
121 	{
122 		setMotionScale(v);
123 	}
124 	/**
125 	The ParallaxLayer's offset relative to the parent ParallaxBackground's $(D ParallaxBackground.scrollOffset).
126 	*/
127 	@property Vector2 motionOffset()
128 	{
129 		return getMotionOffset();
130 	}
131 	/// ditto
132 	@property void motionOffset(Vector2 v)
133 	{
134 		setMotionOffset(v);
135 	}
136 	/**
137 	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. Default value: `(0, 0)`.
138 	*/
139 	@property Vector2 motionMirroring()
140 	{
141 		return getMirroring();
142 	}
143 	/// ditto
144 	@property void motionMirroring(Vector2 v)
145 	{
146 		setMirroring(v);
147 	}
148 }