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