1 /**
2 Input event type for screen touch events.
3 (only available on mobile devices)
4 
5 Copyright:
6 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
7 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
8 Copyright (c) 2017-2018 Godot-D contributors  
9 
10 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
11 
12 
13 */
14 module godot.inputeventscreentouch;
15 import std.meta : AliasSeq, staticIndexOf;
16 import std.traits : Unqual;
17 import godot.d.traits;
18 import godot.core;
19 import godot.c;
20 import godot.d.bind;
21 import godot.d.reference;
22 import godot.globalenums;
23 import godot.object;
24 import godot.classdb;
25 import godot.inputevent;
26 import godot.resource;
27 /**
28 Input event type for screen touch events.
29 (only available on mobile devices)
30 
31 Stores multi-touch press/release information. Supports touch press, touch release and $(D index) for multi-touch count and order.
32 */
33 @GodotBaseClass struct InputEventScreenTouch
34 {
35 	package(godot) enum string _GODOT_internal_name = "InputEventScreenTouch";
36 public:
37 @nogc nothrow:
38 	union { /** */ godot_object _godot_object; /** */ InputEvent _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_index") GodotMethod!(long) getIndex;
46 		@GodotName("get_position") GodotMethod!(Vector2) getPosition;
47 		@GodotName("set_index") GodotMethod!(void, long) setIndex;
48 		@GodotName("set_position") GodotMethod!(void, Vector2) setPosition;
49 		@GodotName("set_pressed") GodotMethod!(void, bool) setPressed;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in InputEventScreenTouch other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of InputEventScreenTouch.
64 	/// Note: use `memnew!InputEventScreenTouch` instead.
65 	static InputEventScreenTouch _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventScreenTouch");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(InputEventScreenTouch)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/**
74 	
75 	*/
76 	long getIndex() const
77 	{
78 		checkClassBinding!(typeof(this))();
79 		return ptrcall!(long)(GDNativeClassBinding.getIndex, _godot_object);
80 	}
81 	/**
82 	
83 	*/
84 	Vector2 getPosition() const
85 	{
86 		checkClassBinding!(typeof(this))();
87 		return ptrcall!(Vector2)(GDNativeClassBinding.getPosition, _godot_object);
88 	}
89 	/**
90 	
91 	*/
92 	void setIndex(in long index)
93 	{
94 		checkClassBinding!(typeof(this))();
95 		ptrcall!(void)(GDNativeClassBinding.setIndex, _godot_object, index);
96 	}
97 	/**
98 	
99 	*/
100 	void setPosition(in Vector2 position)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(GDNativeClassBinding.setPosition, _godot_object, position);
104 	}
105 	/**
106 	
107 	*/
108 	void setPressed(in bool pressed)
109 	{
110 		checkClassBinding!(typeof(this))();
111 		ptrcall!(void)(GDNativeClassBinding.setPressed, _godot_object, pressed);
112 	}
113 	/**
114 	The touch index in the case of a multi-touch event. One index = one finger.
115 	*/
116 	@property long index()
117 	{
118 		return getIndex();
119 	}
120 	/// ditto
121 	@property void index(long v)
122 	{
123 		setIndex(v);
124 	}
125 	/**
126 	The touch position.
127 	*/
128 	@property Vector2 position()
129 	{
130 		return getPosition();
131 	}
132 	/// ditto
133 	@property void position(Vector2 v)
134 	{
135 		setPosition(v);
136 	}
137 	/**
138 	If `true`, the touch's state is pressed. If `false`, the touch's state is released.
139 	*/
140 	@property bool pressed()
141 	{
142 		return isPressed();
143 	}
144 	/// ditto
145 	@property void pressed(bool v)
146 	{
147 		setPressed(v);
148 	}
149 }