1 /**
2 A Texture capable of storing many smaller Textures with offsets.
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.largetexture;
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.texture;
24 import godot.resource;
25 import godot.reference;
26 /**
27 A Texture capable of storing many smaller Textures with offsets.
28 
29 You can dynamically add pieces($(D Texture)) to this `LargeTexture` using different offsets.
30 */
31 @GodotBaseClass struct LargeTexture
32 {
33 	enum string _GODOT_internal_name = "LargeTexture";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; Texture _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct _classBinding
41 	{
42 		__gshared:
43 		@GodotName("add_piece") GodotMethod!(long, Vector2, Texture) addPiece;
44 		@GodotName("set_piece_offset") GodotMethod!(void, long, Vector2) setPieceOffset;
45 		@GodotName("set_piece_texture") GodotMethod!(void, long, Texture) setPieceTexture;
46 		@GodotName("set_size") GodotMethod!(void, Vector2) setSize;
47 		@GodotName("clear") GodotMethod!(void) clear;
48 		@GodotName("get_piece_count") GodotMethod!(long) getPieceCount;
49 		@GodotName("get_piece_offset") GodotMethod!(Vector2, long) getPieceOffset;
50 		@GodotName("get_piece_texture") GodotMethod!(Texture, long) getPieceTexture;
51 		@GodotName("_set_data") GodotMethod!(void, Array) _setData;
52 		@GodotName("_get_data") GodotMethod!(Array) _getData;
53 	}
54 	bool opEquals(in LargeTexture other) const { return _godot_object.ptr is other._godot_object.ptr; }
55 	LargeTexture opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
56 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
57 	mixin baseCasts;
58 	static LargeTexture _new()
59 	{
60 		static godot_class_constructor constructor;
61 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("LargeTexture");
62 		if(constructor is null) return typeof(this).init;
63 		return cast(LargeTexture)(constructor());
64 	}
65 	@disable new(size_t s);
66 	/**
67 	Add another $(D Texture) to this `LargeTexture`, starting on offset "ofs".
68 	*/
69 	long addPiece(in Vector2 ofs, Texture texture)
70 	{
71 		checkClassBinding!(typeof(this))();
72 		return ptrcall!(long)(_classBinding.addPiece, _godot_object, ofs, texture);
73 	}
74 	/**
75 	Sets the offset of the piece with index "idx" to "ofs".
76 	*/
77 	void setPieceOffset(in long idx, in Vector2 ofs)
78 	{
79 		checkClassBinding!(typeof(this))();
80 		ptrcall!(void)(_classBinding.setPieceOffset, _godot_object, idx, ofs);
81 	}
82 	/**
83 	Sets the $(D Texture) of the piece with index "idx" to "texture".
84 	*/
85 	void setPieceTexture(in long idx, Texture texture)
86 	{
87 		checkClassBinding!(typeof(this))();
88 		ptrcall!(void)(_classBinding.setPieceTexture, _godot_object, idx, texture);
89 	}
90 	/**
91 	Sets the size of this `LargeTexture`.
92 	*/
93 	void setSize(in Vector2 size)
94 	{
95 		checkClassBinding!(typeof(this))();
96 		ptrcall!(void)(_classBinding.setSize, _godot_object, size);
97 	}
98 	/**
99 	Clears the `LargeTexture`.
100 	*/
101 	void clear()
102 	{
103 		checkClassBinding!(typeof(this))();
104 		ptrcall!(void)(_classBinding.clear, _godot_object);
105 	}
106 	/**
107 	Returns the number of pieces currently in this `LargeTexture`.
108 	*/
109 	long getPieceCount() const
110 	{
111 		checkClassBinding!(typeof(this))();
112 		return ptrcall!(long)(_classBinding.getPieceCount, _godot_object);
113 	}
114 	/**
115 	Returns the offset of the piece with index "idx".
116 	*/
117 	Vector2 getPieceOffset(in long idx) const
118 	{
119 		checkClassBinding!(typeof(this))();
120 		return ptrcall!(Vector2)(_classBinding.getPieceOffset, _godot_object, idx);
121 	}
122 	/**
123 	Returns the $(D Texture) of the piece with index "idx".
124 	*/
125 	Ref!Texture getPieceTexture(in long idx) const
126 	{
127 		checkClassBinding!(typeof(this))();
128 		return ptrcall!(Texture)(_classBinding.getPieceTexture, _godot_object, idx);
129 	}
130 	/**
131 	
132 	*/
133 	void _setData(in Array data)
134 	{
135 		Array _GODOT_args = Array.empty_array;
136 		_GODOT_args.append(data);
137 		String _GODOT_method_name = String("_set_data");
138 		this.callv(_GODOT_method_name, _GODOT_args);
139 	}
140 	/**
141 	
142 	*/
143 	Array _getData() const
144 	{
145 		Array _GODOT_args = Array.empty_array;
146 		String _GODOT_method_name = String("_get_data");
147 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Array);
148 	}
149 	/**
150 	
151 	*/
152 	@property Array _data()
153 	{
154 		return _getData();
155 	}
156 	/// ditto
157 	@property void _data(Array v)
158 	{
159 		_setData(v);
160 	}
161 }