1 /** 2 A custom effect for use with $(D RichTextLabel). 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.richtexteffect; 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.resource; 25 import godot.reference; 26 import godot.charfxtransform; 27 /** 28 A custom effect for use with $(D RichTextLabel). 29 30 $(B Note:) For a $(D RichTextEffect) to be usable, a BBCode tag must be defined as a member variable called `bbcode` in the script. 31 32 33 # The RichTextEffect will be usable like this: `$(D example)Some text$(D /example)` 34 var bbcode = "example" 35 36 37 $(B Note:) As soon as a $(D RichTextLabel) contains at least one $(D RichTextEffect), it will continuously process the effect unless the project is paused. This may impact battery life negatively. 38 */ 39 @GodotBaseClass struct RichTextEffect 40 { 41 package(godot) enum string _GODOT_internal_name = "RichTextEffect"; 42 public: 43 @nogc nothrow: 44 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 45 alias _GODOT_base this; 46 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 47 package(godot) __gshared bool _classBindingInitialized = false; 48 package(godot) static struct GDNativeClassBinding 49 { 50 __gshared: 51 @GodotName("_process_custom_fx") GodotMethod!(bool, CharFXTransform) _processCustomFx; 52 } 53 /// 54 pragma(inline, true) bool opEquals(in RichTextEffect 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 RichTextEffect. 66 /// Note: use `memnew!RichTextEffect` instead. 67 static RichTextEffect _new() 68 { 69 static godot_class_constructor constructor; 70 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("RichTextEffect"); 71 if(constructor is null) return typeof(this).init; 72 return cast(RichTextEffect)(constructor()); 73 } 74 @disable new(size_t s); 75 /** 76 Override this method to modify properties in `char_fx`. The method must return `true` if the character could be transformed successfully. If the method returns `false`, it will skip transformation to avoid displaying broken text. 77 */ 78 bool _processCustomFx(CharFXTransform char_fx) 79 { 80 Array _GODOT_args = Array.make(); 81 _GODOT_args.append(char_fx); 82 String _GODOT_method_name = String("_process_custom_fx"); 83 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 84 } 85 }