1 /**
2 Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with `SCREEN_TEXTURE` in the `texture()` function.
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.backbuffercopy;
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.node2d;
24 import godot.canvasitem;
25 import godot.node;
26 /**
27 Copies a region of the screen (or the whole screen) to a buffer so it can be accessed with `SCREEN_TEXTURE` in the `texture()` function.
28 
29 Node for back-buffering the currently displayed screen. The region defined in the BackBufferCopy node is bufferized with the content of the screen it covers, or the entire screen according to the copy mode set. Use `SCREEN_TEXTURE` in the `texture()` function to access the buffer.
30 */
31 @GodotBaseClass struct BackBufferCopy
32 {
33 	enum string _GODOT_internal_name = "BackBufferCopy";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; Node2D _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("set_rect") GodotMethod!(void, Rect2) setRect;
44 		@GodotName("get_rect") GodotMethod!(Rect2) getRect;
45 		@GodotName("set_copy_mode") GodotMethod!(void, long) setCopyMode;
46 		@GodotName("get_copy_mode") GodotMethod!(BackBufferCopy.CopyMode) getCopyMode;
47 	}
48 	bool opEquals(in BackBufferCopy other) const { return _godot_object.ptr is other._godot_object.ptr; }
49 	BackBufferCopy opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
50 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
51 	mixin baseCasts;
52 	static BackBufferCopy _new()
53 	{
54 		static godot_class_constructor constructor;
55 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("BackBufferCopy");
56 		if(constructor is null) return typeof(this).init;
57 		return cast(BackBufferCopy)(constructor());
58 	}
59 	@disable new(size_t s);
60 	/// 
61 	enum CopyMode : int
62 	{
63 		/**
64 		Disables the buffering mode. This means the BackBufferCopy node will directly use the portion of screen it covers.
65 		*/
66 		copyModeDisabled = 0,
67 		/**
68 		BackBufferCopy buffers a rectangular region.
69 		*/
70 		copyModeRect = 1,
71 		/**
72 		BackBufferCopy buffers the entire screen.
73 		*/
74 		copyModeViewport = 2,
75 	}
76 	/// 
77 	enum Constants : int
78 	{
79 		copyModeDisabled = 0,
80 		copyModeRect = 1,
81 		copyModeViewport = 2,
82 	}
83 	/**
84 	
85 	*/
86 	void setRect(in Rect2 rect)
87 	{
88 		checkClassBinding!(typeof(this))();
89 		ptrcall!(void)(_classBinding.setRect, _godot_object, rect);
90 	}
91 	/**
92 	
93 	*/
94 	Rect2 getRect() const
95 	{
96 		checkClassBinding!(typeof(this))();
97 		return ptrcall!(Rect2)(_classBinding.getRect, _godot_object);
98 	}
99 	/**
100 	
101 	*/
102 	void setCopyMode(in long copy_mode)
103 	{
104 		checkClassBinding!(typeof(this))();
105 		ptrcall!(void)(_classBinding.setCopyMode, _godot_object, copy_mode);
106 	}
107 	/**
108 	
109 	*/
110 	BackBufferCopy.CopyMode getCopyMode() const
111 	{
112 		checkClassBinding!(typeof(this))();
113 		return ptrcall!(BackBufferCopy.CopyMode)(_classBinding.getCopyMode, _godot_object);
114 	}
115 	/**
116 	Buffer mode. See `COPY_MODE_*` constants.
117 	*/
118 	@property BackBufferCopy.CopyMode copyMode()
119 	{
120 		return getCopyMode();
121 	}
122 	/// ditto
123 	@property void copyMode(long v)
124 	{
125 		setCopyMode(v);
126 	}
127 	/**
128 	The area covered by the BackBufferCopy. Only used if `copy_mode` is `COPY_MODE_RECT`.
129 	*/
130 	@property Rect2 rect()
131 	{
132 		return getRect();
133 	}
134 	/// ditto
135 	@property void rect(Rect2 v)
136 	{
137 		setRect(v);
138 	}
139 }