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.meta;
18 import godot.core;
19 import godot.c;
20 import godot.d.bind;
21 import godot.d.reference;
22 import godot.object;
23 import godot.classdb;
24 import godot.inputevent;
25 import godot.resource;
26 import godot.reference;
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 	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 _classBinding
43 	{
44 		__gshared:
45 		@GodotName("set_index") GodotMethod!(void, long) setIndex;
46 		@GodotName("get_index") GodotMethod!(long) getIndex;
47 		@GodotName("set_position") GodotMethod!(void, Vector2) setPosition;
48 		@GodotName("get_position") GodotMethod!(Vector2) getPosition;
49 		@GodotName("set_pressed") GodotMethod!(void, bool) setPressed;
50 	}
51 	bool opEquals(in InputEventScreenTouch other) const { return _godot_object.ptr is other._godot_object.ptr; }
52 	InputEventScreenTouch opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
53 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
54 	mixin baseCasts;
55 	static InputEventScreenTouch _new()
56 	{
57 		static godot_class_constructor constructor;
58 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventScreenTouch");
59 		if(constructor is null) return typeof(this).init;
60 		return cast(InputEventScreenTouch)(constructor());
61 	}
62 	@disable new(size_t s);
63 	/**
64 	
65 	*/
66 	void setIndex(in long index)
67 	{
68 		checkClassBinding!(typeof(this))();
69 		ptrcall!(void)(_classBinding.setIndex, _godot_object, index);
70 	}
71 	/**
72 	
73 	*/
74 	long getIndex() const
75 	{
76 		checkClassBinding!(typeof(this))();
77 		return ptrcall!(long)(_classBinding.getIndex, _godot_object);
78 	}
79 	/**
80 	
81 	*/
82 	void setPosition(in Vector2 position)
83 	{
84 		checkClassBinding!(typeof(this))();
85 		ptrcall!(void)(_classBinding.setPosition, _godot_object, position);
86 	}
87 	/**
88 	
89 	*/
90 	Vector2 getPosition() const
91 	{
92 		checkClassBinding!(typeof(this))();
93 		return ptrcall!(Vector2)(_classBinding.getPosition, _godot_object);
94 	}
95 	/**
96 	
97 	*/
98 	void setPressed(in bool pressed)
99 	{
100 		checkClassBinding!(typeof(this))();
101 		ptrcall!(void)(_classBinding.setPressed, _godot_object, pressed);
102 	}
103 	/**
104 	Touch index in the case of a multi-touch event. One index = one finger.
105 	*/
106 	@property long index()
107 	{
108 		return getIndex();
109 	}
110 	/// ditto
111 	@property void index(long v)
112 	{
113 		setIndex(v);
114 	}
115 	/**
116 	Touch position.
117 	*/
118 	@property Vector2 position()
119 	{
120 		return getPosition();
121 	}
122 	/// ditto
123 	@property void position(Vector2 v)
124 	{
125 		setPosition(v);
126 	}
127 	/**
128 	If `true` the touch's state is pressed. If `false` the touch's state is released.
129 	*/
130 	@property bool pressed()
131 	{
132 		return isPressed();
133 	}
134 	/// ditto
135 	@property void pressed(bool v)
136 	{
137 		setPressed(v);
138 	}
139 }