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.visibilitynotifier;
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.spatial;
24 import godot.node;
25 /**
26 Detects when the node is visible on screen.
27 
28 The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a $(D Camera)'s view.
29 */
30 @GodotBaseClass struct VisibilityNotifier
31 {
32 	enum string _GODOT_internal_name = "VisibilityNotifier";
33 public:
34 @nogc nothrow:
35 	union { godot_object _godot_object; Spatial _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 _classBinding
40 	{
41 		__gshared:
42 		@GodotName("set_aabb") GodotMethod!(void, AABB) setAabb;
43 		@GodotName("get_aabb") GodotMethod!(AABB) getAabb;
44 		@GodotName("is_on_screen") GodotMethod!(bool) isOnScreen;
45 	}
46 	bool opEquals(in VisibilityNotifier other) const { return _godot_object.ptr is other._godot_object.ptr; }
47 	VisibilityNotifier opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
48 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
49 	mixin baseCasts;
50 	static VisibilityNotifier _new()
51 	{
52 		static godot_class_constructor constructor;
53 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisibilityNotifier");
54 		if(constructor is null) return typeof(this).init;
55 		return cast(VisibilityNotifier)(constructor());
56 	}
57 	@disable new(size_t s);
58 	/**
59 	
60 	*/
61 	void setAabb(in AABB rect)
62 	{
63 		checkClassBinding!(typeof(this))();
64 		ptrcall!(void)(_classBinding.setAabb, _godot_object, rect);
65 	}
66 	/**
67 	
68 	*/
69 	AABB getAabb() const
70 	{
71 		checkClassBinding!(typeof(this))();
72 		return ptrcall!(AABB)(_classBinding.getAabb, _godot_object);
73 	}
74 	/**
75 	If `true` the bounding box is on the screen.
76 	*/
77 	bool isOnScreen() const
78 	{
79 		checkClassBinding!(typeof(this))();
80 		return ptrcall!(bool)(_classBinding.isOnScreen, _godot_object);
81 	}
82 	/**
83 	The VisibilityNotifier's bounding box.
84 	*/
85 	@property AABB aabb()
86 	{
87 		return getAabb();
88 	}
89 	/// ditto
90 	@property void aabb(AABB v)
91 	{
92 		setAabb(v);
93 	}
94 }