1 /** 2 Controls how an individual character will be displayed in a $(D RichTextEffect). 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.charfxtransform; 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.reference; 25 /** 26 Controls how an individual character will be displayed in a $(D RichTextEffect). 27 28 By setting various properties on this object, you can control how individual characters will be displayed in a $(D RichTextEffect). 29 */ 30 @GodotBaseClass struct CharFXTransform 31 { 32 package(godot) enum string _GODOT_internal_name = "CharFXTransform"; 33 public: 34 @nogc nothrow: 35 union { /** */ godot_object _godot_object; /** */ Reference _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct GDNativeClassBinding 40 { 41 __gshared: 42 @GodotName("get_absolute_index") GodotMethod!(long) getAbsoluteIndex; 43 @GodotName("get_character") GodotMethod!(long) getCharacter; 44 @GodotName("get_color") GodotMethod!(Color) getColor; 45 @GodotName("get_elapsed_time") GodotMethod!(double) getElapsedTime; 46 @GodotName("get_environment") GodotMethod!(Dictionary) getEnvironment; 47 @GodotName("get_offset") GodotMethod!(Vector2) getOffset; 48 @GodotName("get_relative_index") GodotMethod!(long) getRelativeIndex; 49 @GodotName("is_visible") GodotMethod!(bool) isVisible; 50 @GodotName("set_absolute_index") GodotMethod!(void, long) setAbsoluteIndex; 51 @GodotName("set_character") GodotMethod!(void, long) setCharacter; 52 @GodotName("set_color") GodotMethod!(void, Color) setColor; 53 @GodotName("set_elapsed_time") GodotMethod!(void, double) setElapsedTime; 54 @GodotName("set_environment") GodotMethod!(void, Dictionary) setEnvironment; 55 @GodotName("set_offset") GodotMethod!(void, Vector2) setOffset; 56 @GodotName("set_relative_index") GodotMethod!(void, long) setRelativeIndex; 57 @GodotName("set_visibility") GodotMethod!(void, bool) setVisibility; 58 } 59 /// 60 pragma(inline, true) bool opEquals(in CharFXTransform other) const 61 { return _godot_object.ptr is other._godot_object.ptr; } 62 /// 63 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 64 { _godot_object.ptr = n; return null; } 65 /// 66 pragma(inline, true) bool opEquals(typeof(null) n) const 67 { return _godot_object.ptr is n; } 68 /// 69 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 70 mixin baseCasts; 71 /// Construct a new instance of CharFXTransform. 72 /// Note: use `memnew!CharFXTransform` instead. 73 static CharFXTransform _new() 74 { 75 static godot_class_constructor constructor; 76 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CharFXTransform"); 77 if(constructor is null) return typeof(this).init; 78 return cast(CharFXTransform)(constructor()); 79 } 80 @disable new(size_t s); 81 /** 82 83 */ 84 long getAbsoluteIndex() 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(long)(GDNativeClassBinding.getAbsoluteIndex, _godot_object); 88 } 89 /** 90 91 */ 92 long getCharacter() 93 { 94 checkClassBinding!(typeof(this))(); 95 return ptrcall!(long)(GDNativeClassBinding.getCharacter, _godot_object); 96 } 97 /** 98 99 */ 100 Color getColor() 101 { 102 checkClassBinding!(typeof(this))(); 103 return ptrcall!(Color)(GDNativeClassBinding.getColor, _godot_object); 104 } 105 /** 106 107 */ 108 double getElapsedTime() 109 { 110 checkClassBinding!(typeof(this))(); 111 return ptrcall!(double)(GDNativeClassBinding.getElapsedTime, _godot_object); 112 } 113 /** 114 115 */ 116 Dictionary getEnvironment() 117 { 118 checkClassBinding!(typeof(this))(); 119 return ptrcall!(Dictionary)(GDNativeClassBinding.getEnvironment, _godot_object); 120 } 121 /** 122 123 */ 124 Vector2 getOffset() 125 { 126 checkClassBinding!(typeof(this))(); 127 return ptrcall!(Vector2)(GDNativeClassBinding.getOffset, _godot_object); 128 } 129 /** 130 131 */ 132 long getRelativeIndex() 133 { 134 checkClassBinding!(typeof(this))(); 135 return ptrcall!(long)(GDNativeClassBinding.getRelativeIndex, _godot_object); 136 } 137 /** 138 139 */ 140 bool isVisible() 141 { 142 checkClassBinding!(typeof(this))(); 143 return ptrcall!(bool)(GDNativeClassBinding.isVisible, _godot_object); 144 } 145 /** 146 147 */ 148 void setAbsoluteIndex(in long index) 149 { 150 checkClassBinding!(typeof(this))(); 151 ptrcall!(void)(GDNativeClassBinding.setAbsoluteIndex, _godot_object, index); 152 } 153 /** 154 155 */ 156 void setCharacter(in long character) 157 { 158 checkClassBinding!(typeof(this))(); 159 ptrcall!(void)(GDNativeClassBinding.setCharacter, _godot_object, character); 160 } 161 /** 162 163 */ 164 void setColor(in Color color) 165 { 166 checkClassBinding!(typeof(this))(); 167 ptrcall!(void)(GDNativeClassBinding.setColor, _godot_object, color); 168 } 169 /** 170 171 */ 172 void setElapsedTime(in double time) 173 { 174 checkClassBinding!(typeof(this))(); 175 ptrcall!(void)(GDNativeClassBinding.setElapsedTime, _godot_object, time); 176 } 177 /** 178 179 */ 180 void setEnvironment(in Dictionary environment) 181 { 182 checkClassBinding!(typeof(this))(); 183 ptrcall!(void)(GDNativeClassBinding.setEnvironment, _godot_object, environment); 184 } 185 /** 186 187 */ 188 void setOffset(in Vector2 offset) 189 { 190 checkClassBinding!(typeof(this))(); 191 ptrcall!(void)(GDNativeClassBinding.setOffset, _godot_object, offset); 192 } 193 /** 194 195 */ 196 void setRelativeIndex(in long index) 197 { 198 checkClassBinding!(typeof(this))(); 199 ptrcall!(void)(GDNativeClassBinding.setRelativeIndex, _godot_object, index); 200 } 201 /** 202 203 */ 204 void setVisibility(in bool visibility) 205 { 206 checkClassBinding!(typeof(this))(); 207 ptrcall!(void)(GDNativeClassBinding.setVisibility, _godot_object, visibility); 208 } 209 /** 210 The index of the current character (starting from 0). Setting this property won't affect drawing. 211 */ 212 @property long absoluteIndex() 213 { 214 return getAbsoluteIndex(); 215 } 216 /// ditto 217 @property void absoluteIndex(long v) 218 { 219 setAbsoluteIndex(v); 220 } 221 /** 222 The Unicode codepoint the character will use. This only affects non-whitespace characters. $(D @GDScript.ord) can be useful here. For example, the following will replace all characters with asterisks: 223 224 225 # `char_fx` is the CharFXTransform parameter from `_process_custom_fx()`. 226 # See the RichTextEffect documentation for details. 227 char_fx.character = ord("*") 228 229 230 */ 231 @property long character() 232 { 233 return getCharacter(); 234 } 235 /// ditto 236 @property void character(long v) 237 { 238 setCharacter(v); 239 } 240 /** 241 The color the character will be drawn with. 242 */ 243 @property Color color() 244 { 245 return getColor(); 246 } 247 /// ditto 248 @property void color(Color v) 249 { 250 setColor(v); 251 } 252 /** 253 The time elapsed since the $(D RichTextLabel) was added to the scene tree (in seconds). Time stops when the project is paused, unless the $(D RichTextLabel)'s $(D Node.pauseMode) is set to $(D constant Node.PAUSE_MODE_PROCESS). 254 $(B Note:) Time still passes while the $(D RichTextLabel) is hidden. 255 */ 256 @property double elapsedTime() 257 { 258 return getElapsedTime(); 259 } 260 /// ditto 261 @property void elapsedTime(double v) 262 { 263 setElapsedTime(v); 264 } 265 /** 266 Contains the arguments passed in the opening BBCode tag. By default, arguments are strings; if their contents match a type such as $(D bool), $(D long) or $(D double), they will be converted automatically. Color codes in the form `#rrggbb` or `#rgb` will be converted to an opaque $(D Color). String arguments may not contain spaces, even if they're quoted. If present, quotes will also be present in the final string. 267 For example, the opening BBCode tag `$(D example foo=hello bar=true baz=42 color=#ffffff)` will map to the following $(D Dictionary): 268 269 270 {"foo": "hello", "bar": true, "baz": 42, "color": Color(1, 1, 1, 1)} 271 272 273 */ 274 @property Dictionary env() 275 { 276 return getEnvironment(); 277 } 278 /// ditto 279 @property void env(Dictionary v) 280 { 281 setEnvironment(v); 282 } 283 /** 284 The position offset the character will be drawn with (in pixels). 285 */ 286 @property Vector2 offset() 287 { 288 return getOffset(); 289 } 290 /// ditto 291 @property void offset(Vector2 v) 292 { 293 setOffset(v); 294 } 295 /** 296 The index of the current character (starting from 0). Setting this property won't affect drawing. 297 */ 298 @property long relativeIndex() 299 { 300 return getRelativeIndex(); 301 } 302 /// ditto 303 @property void relativeIndex(long v) 304 { 305 setRelativeIndex(v); 306 } 307 /** 308 If `true`, the character will be drawn. If `false`, the character will be hidden. Characters around hidden characters will reflow to take the space of hidden characters. If this is not desired, set their $(D color) to `Color(1, 1, 1, 0)` instead. 309 */ 310 @property bool visible() 311 { 312 return isVisible(); 313 } 314 /// ditto 315 @property void visible(bool v) 316 { 317 setVisibility(v); 318 } 319 }