1 /** 2 Texture which displays the content of a $(D Viewport). 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.viewporttexture; 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 import godot.resource; 26 import godot.reference; 27 /** 28 Texture which displays the content of a $(D Viewport). 29 30 Displays the content of a $(D Viewport) node as a dynamic $(D Texture). This can be used to mix controls, 2D, and 3D elements in the same scene. 31 To create a ViewportTexture in code, use the $(D Viewport.getTexture) method on the target viewport. 32 */ 33 @GodotBaseClass struct ViewportTexture 34 { 35 package(godot) enum string _GODOT_internal_name = "ViewportTexture"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ Texture _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 GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("get_viewport_path_in_scene") GodotMethod!(NodePath) getViewportPathInScene; 46 @GodotName("set_viewport_path_in_scene") GodotMethod!(void, NodePath) setViewportPathInScene; 47 } 48 /// 49 pragma(inline, true) bool opEquals(in ViewportTexture other) const 50 { return _godot_object.ptr is other._godot_object.ptr; } 51 /// 52 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 53 { _godot_object.ptr = n; return null; } 54 /// 55 pragma(inline, true) bool opEquals(typeof(null) n) const 56 { return _godot_object.ptr is n; } 57 /// 58 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 59 mixin baseCasts; 60 /// Construct a new instance of ViewportTexture. 61 /// Note: use `memnew!ViewportTexture` instead. 62 static ViewportTexture _new() 63 { 64 static godot_class_constructor constructor; 65 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ViewportTexture"); 66 if(constructor is null) return typeof(this).init; 67 return cast(ViewportTexture)(constructor()); 68 } 69 @disable new(size_t s); 70 /** 71 72 */ 73 NodePath getViewportPathInScene() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(NodePath)(GDNativeClassBinding.getViewportPathInScene, _godot_object); 77 } 78 /** 79 80 */ 81 void setViewportPathInScene(NodePathArg0)(in NodePathArg0 path) 82 { 83 checkClassBinding!(typeof(this))(); 84 ptrcall!(void)(GDNativeClassBinding.setViewportPathInScene, _godot_object, path); 85 } 86 /** 87 The path to the $(D Viewport) node to display. This is relative to the scene root, not to the node which uses the texture. 88 */ 89 @property NodePath viewportPath() 90 { 91 return getViewportPathInScene(); 92 } 93 /// ditto 94 @property void viewportPath(NodePath v) 95 { 96 setViewportPathInScene(v); 97 } 98 }