1 /**
2 Detects when the node is visible on screen.
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.visibilitynotifier2d;
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 Detects when the node is visible on screen.
28 
29 The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
30 */
31 @GodotBaseClass struct VisibilityNotifier2D
32 {
33 	enum string _GODOT_internal_name = "VisibilityNotifier2D";
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("is_on_screen") GodotMethod!(bool) isOnScreen;
46 	}
47 	bool opEquals(in VisibilityNotifier2D other) const { return _godot_object.ptr is other._godot_object.ptr; }
48 	VisibilityNotifier2D opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
49 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
50 	mixin baseCasts;
51 	static VisibilityNotifier2D _new()
52 	{
53 		static godot_class_constructor constructor;
54 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisibilityNotifier2D");
55 		if(constructor is null) return typeof(this).init;
56 		return cast(VisibilityNotifier2D)(constructor());
57 	}
58 	@disable new(size_t s);
59 	/**
60 	
61 	*/
62 	void setRect(in Rect2 rect)
63 	{
64 		checkClassBinding!(typeof(this))();
65 		ptrcall!(void)(_classBinding.setRect, _godot_object, rect);
66 	}
67 	/**
68 	
69 	*/
70 	Rect2 getRect() const
71 	{
72 		checkClassBinding!(typeof(this))();
73 		return ptrcall!(Rect2)(_classBinding.getRect, _godot_object);
74 	}
75 	/**
76 	If `true` the bounding rectangle is on the screen.
77 	*/
78 	bool isOnScreen() const
79 	{
80 		checkClassBinding!(typeof(this))();
81 		return ptrcall!(bool)(_classBinding.isOnScreen, _godot_object);
82 	}
83 	/**
84 	The VisibilityNotifier2D's bounding rectangle.
85 	*/
86 	@property Rect2 rect()
87 	{
88 		return getRect();
89 	}
90 	/// ditto
91 	@property void rect(Rect2 v)
92 	{
93 		setRect(v);
94 	}
95 }