1 /**
2 A singleton that deals with inputs.
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.input;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.inputevent;
24 import godot.resource;
25 /**
26 A singleton that deals with inputs.
27 
28 This includes key presses, mouse buttons and movement, joypads, and input actions. Actions and their events can be set in the $(B Input Map) tab in the $(B Project > Project Settings), or with the $(D InputMap) class.
29 */
30 @GodotBaseClass struct InputSingleton
31 {
32 	package(godot) enum string _GODOT_internal_name = "Input";
33 public:
34 @nogc nothrow:
35 	union { /** */ godot_object _godot_object; /** */ GodotObject _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 GDNativeClassBinding
40 	{
41 		__gshared:
42 		godot_object _singleton;
43 		immutable char* _singletonName = "Input";
44 		@GodotName("action_press") GodotMethod!(void, String, double) actionPress;
45 		@GodotName("action_release") GodotMethod!(void, String) actionRelease;
46 		@GodotName("add_joy_mapping") GodotMethod!(void, String, bool) addJoyMapping;
47 		@GodotName("get_accelerometer") GodotMethod!(Vector3) getAccelerometer;
48 		@GodotName("get_action_strength") GodotMethod!(double, String) getActionStrength;
49 		@GodotName("get_connected_joypads") GodotMethod!(Array) getConnectedJoypads;
50 		@GodotName("get_current_cursor_shape") GodotMethod!(Input.CursorShape) getCurrentCursorShape;
51 		@GodotName("get_gravity") GodotMethod!(Vector3) getGravity;
52 		@GodotName("get_gyroscope") GodotMethod!(Vector3) getGyroscope;
53 		@GodotName("get_joy_axis") GodotMethod!(double, long, long) getJoyAxis;
54 		@GodotName("get_joy_axis_index_from_string") GodotMethod!(long, String) getJoyAxisIndexFromString;
55 		@GodotName("get_joy_axis_string") GodotMethod!(String, long) getJoyAxisString;
56 		@GodotName("get_joy_button_index_from_string") GodotMethod!(long, String) getJoyButtonIndexFromString;
57 		@GodotName("get_joy_button_string") GodotMethod!(String, long) getJoyButtonString;
58 		@GodotName("get_joy_guid") GodotMethod!(String, long) getJoyGuid;
59 		@GodotName("get_joy_name") GodotMethod!(String, long) getJoyName;
60 		@GodotName("get_joy_vibration_duration") GodotMethod!(double, long) getJoyVibrationDuration;
61 		@GodotName("get_joy_vibration_strength") GodotMethod!(Vector2, long) getJoyVibrationStrength;
62 		@GodotName("get_last_mouse_speed") GodotMethod!(Vector2) getLastMouseSpeed;
63 		@GodotName("get_magnetometer") GodotMethod!(Vector3) getMagnetometer;
64 		@GodotName("get_mouse_button_mask") GodotMethod!(long) getMouseButtonMask;
65 		@GodotName("get_mouse_mode") GodotMethod!(Input.MouseMode) getMouseMode;
66 		@GodotName("is_action_just_pressed") GodotMethod!(bool, String) isActionJustPressed;
67 		@GodotName("is_action_just_released") GodotMethod!(bool, String) isActionJustReleased;
68 		@GodotName("is_action_pressed") GodotMethod!(bool, String) isActionPressed;
69 		@GodotName("is_joy_button_pressed") GodotMethod!(bool, long, long) isJoyButtonPressed;
70 		@GodotName("is_joy_known") GodotMethod!(bool, long) isJoyKnown;
71 		@GodotName("is_key_pressed") GodotMethod!(bool, long) isKeyPressed;
72 		@GodotName("is_mouse_button_pressed") GodotMethod!(bool, long) isMouseButtonPressed;
73 		@GodotName("joy_connection_changed") GodotMethod!(void, long, bool, String, String) joyConnectionChanged;
74 		@GodotName("parse_input_event") GodotMethod!(void, InputEvent) parseInputEvent;
75 		@GodotName("remove_joy_mapping") GodotMethod!(void, String) removeJoyMapping;
76 		@GodotName("set_custom_mouse_cursor") GodotMethod!(void, Resource, long, Vector2) setCustomMouseCursor;
77 		@GodotName("set_default_cursor_shape") GodotMethod!(void, long) setDefaultCursorShape;
78 		@GodotName("set_mouse_mode") GodotMethod!(void, long) setMouseMode;
79 		@GodotName("set_use_accumulated_input") GodotMethod!(void, bool) setUseAccumulatedInput;
80 		@GodotName("start_joy_vibration") GodotMethod!(void, long, double, double, double) startJoyVibration;
81 		@GodotName("stop_joy_vibration") GodotMethod!(void, long) stopJoyVibration;
82 		@GodotName("vibrate_handheld") GodotMethod!(void, long) vibrateHandheld;
83 		@GodotName("warp_mouse_position") GodotMethod!(void, Vector2) warpMousePosition;
84 	}
85 	/// 
86 	pragma(inline, true) bool opEquals(in InputSingleton other) const
87 	{ return _godot_object.ptr is other._godot_object.ptr; }
88 	/// 
89 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
90 	{ _godot_object.ptr = n; return null; }
91 	/// 
92 	pragma(inline, true) bool opEquals(typeof(null) n) const
93 	{ return _godot_object.ptr is n; }
94 	/// 
95 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
96 	mixin baseCasts;
97 	/// Construct a new instance of InputSingleton.
98 	/// Note: use `memnew!InputSingleton` instead.
99 	static InputSingleton _new()
100 	{
101 		static godot_class_constructor constructor;
102 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Input");
103 		if(constructor is null) return typeof(this).init;
104 		return cast(InputSingleton)(constructor());
105 	}
106 	@disable new(size_t s);
107 	/// 
108 	enum MouseMode : int
109 	{
110 		/**
111 		Makes the mouse cursor visible if it is hidden.
112 		*/
113 		mouseModeVisible = 0,
114 		/**
115 		Makes the mouse cursor hidden if it is visible.
116 		*/
117 		mouseModeHidden = 1,
118 		/**
119 		Captures the mouse. The mouse will be hidden and its position locked at the center of the screen.
120 		$(B Note:) If you want to process the mouse's movement in this mode, you need to use $(D InputEventMouseMotion.relative).
121 		*/
122 		mouseModeCaptured = 2,
123 		/**
124 		Makes the mouse cursor visible but confines it to the game window.
125 		*/
126 		mouseModeConfined = 3,
127 	}
128 	/// 
129 	enum CursorShape : int
130 	{
131 		/**
132 		Arrow cursor. Standard, default pointing cursor.
133 		*/
134 		cursorArrow = 0,
135 		/**
136 		I-beam cursor. Usually used to show where the text cursor will appear when the mouse is clicked.
137 		*/
138 		cursorIbeam = 1,
139 		/**
140 		Pointing hand cursor. Usually used to indicate the pointer is over a link or other interactable item.
141 		*/
142 		cursorPointingHand = 2,
143 		/**
144 		Cross cursor. Typically appears over regions in which a drawing operation can be performed or for selections.
145 		*/
146 		cursorCross = 3,
147 		/**
148 		Wait cursor. Indicates that the application is busy performing an operation. This cursor shape denotes that the application is still usable during the operation.
149 		*/
150 		cursorWait = 4,
151 		/**
152 		Busy cursor. Indicates that the application is busy performing an operation. This cursor shape denotes that the application isn't usable during the operation (e.g. something is blocking its main thread).
153 		*/
154 		cursorBusy = 5,
155 		/**
156 		Drag cursor. Usually displayed when dragging something.
157 		*/
158 		cursorDrag = 6,
159 		/**
160 		Can drop cursor. Usually displayed when dragging something to indicate that it can be dropped at the current position.
161 		*/
162 		cursorCanDrop = 7,
163 		/**
164 		Forbidden cursor. Indicates that the current action is forbidden (for example, when dragging something) or that the control at a position is disabled.
165 		*/
166 		cursorForbidden = 8,
167 		/**
168 		Vertical resize mouse cursor. A double-headed vertical arrow. It tells the user they can resize the window or the panel vertically.
169 		*/
170 		cursorVsize = 9,
171 		/**
172 		Horizontal resize mouse cursor. A double-headed horizontal arrow. It tells the user they can resize the window or the panel horizontally.
173 		*/
174 		cursorHsize = 10,
175 		/**
176 		Window resize mouse cursor. The cursor is a double-headed arrow that goes from the bottom left to the top right. It tells the user they can resize the window or the panel both horizontally and vertically.
177 		*/
178 		cursorBdiagsize = 11,
179 		/**
180 		Window resize mouse cursor. The cursor is a double-headed arrow that goes from the top left to the bottom right, the opposite of $(D constant CURSOR_BDIAGSIZE). It tells the user they can resize the window or the panel both horizontally and vertically.
181 		*/
182 		cursorFdiagsize = 12,
183 		/**
184 		Move cursor. Indicates that something can be moved.
185 		*/
186 		cursorMove = 13,
187 		/**
188 		Vertical split mouse cursor. On Windows, it's the same as $(D constant CURSOR_VSIZE).
189 		*/
190 		cursorVsplit = 14,
191 		/**
192 		Horizontal split mouse cursor. On Windows, it's the same as $(D constant CURSOR_HSIZE).
193 		*/
194 		cursorHsplit = 15,
195 		/**
196 		Help cursor. Usually a question mark.
197 		*/
198 		cursorHelp = 16,
199 	}
200 	/// 
201 	enum Constants : int
202 	{
203 		cursorArrow = 0,
204 		mouseModeVisible = 0,
205 		cursorIbeam = 1,
206 		mouseModeHidden = 1,
207 		mouseModeCaptured = 2,
208 		cursorPointingHand = 2,
209 		cursorCross = 3,
210 		mouseModeConfined = 3,
211 		cursorWait = 4,
212 		cursorBusy = 5,
213 		cursorDrag = 6,
214 		cursorCanDrop = 7,
215 		cursorForbidden = 8,
216 		cursorVsize = 9,
217 		cursorHsize = 10,
218 		cursorBdiagsize = 11,
219 		cursorFdiagsize = 12,
220 		cursorMove = 13,
221 		cursorVsplit = 14,
222 		cursorHsplit = 15,
223 		cursorHelp = 16,
224 	}
225 	/**
226 	This will simulate pressing the specified action.
227 	The strength can be used for non-boolean actions, it's ranged between 0 and 1 representing the intensity of the given action.
228 	$(B Note:) This method will not cause any $(D Node._input) calls. It is intended to be used with $(D isActionPressed) and $(D isActionJustPressed). If you want to simulate `_input`, use $(D parseInputEvent) instead.
229 	*/
230 	void actionPress(in String action, in double strength = 1)
231 	{
232 		checkClassBinding!(typeof(this))();
233 		ptrcall!(void)(GDNativeClassBinding.actionPress, _godot_object, action, strength);
234 	}
235 	/**
236 	If the specified action is already pressed, this will release it.
237 	*/
238 	void actionRelease(in String action)
239 	{
240 		checkClassBinding!(typeof(this))();
241 		ptrcall!(void)(GDNativeClassBinding.actionRelease, _godot_object, action);
242 	}
243 	/**
244 	Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices.
245 	*/
246 	void addJoyMapping(in String mapping, in bool update_existing = false)
247 	{
248 		checkClassBinding!(typeof(this))();
249 		ptrcall!(void)(GDNativeClassBinding.addJoyMapping, _godot_object, mapping, update_existing);
250 	}
251 	/**
252 	Returns the acceleration of the device's accelerometer sensor, if the device has one. Otherwise, the method returns $(D constant Vector3.ZERO).
253 	Note this method returns an empty $(D Vector3) when running from the editor even when your device has an accelerometer. You must export your project to a supported device to read values from the accelerometer.
254 	$(B Note:) This method only works on iOS, Android, and UWP. On other platforms, it always returns $(D constant Vector3.ZERO). On Android the unit of measurement for each axis is m/s² while on iOS and UWP it's a multiple of the Earth's gravitational acceleration `g` (~9.81 m/s²).
255 	*/
256 	Vector3 getAccelerometer() const
257 	{
258 		checkClassBinding!(typeof(this))();
259 		return ptrcall!(Vector3)(GDNativeClassBinding.getAccelerometer, _godot_object);
260 	}
261 	/**
262 	Returns a value between 0 and 1 representing the intensity of the given action. In a joypad, for example, the further away the axis (analog sticks or L2, R2 triggers) is from the dead zone, the closer the value will be to 1. If the action is mapped to a control that has no axis as the keyboard, the value returned will be 0 or 1.
263 	*/
264 	double getActionStrength(in String action) const
265 	{
266 		checkClassBinding!(typeof(this))();
267 		return ptrcall!(double)(GDNativeClassBinding.getActionStrength, _godot_object, action);
268 	}
269 	/**
270 	Returns an $(D Array) containing the device IDs of all currently connected joypads.
271 	*/
272 	Array getConnectedJoypads()
273 	{
274 		checkClassBinding!(typeof(this))();
275 		return ptrcall!(Array)(GDNativeClassBinding.getConnectedJoypads, _godot_object);
276 	}
277 	/**
278 	Returns the currently assigned cursor shape (see $(D cursorshape)).
279 	*/
280 	Input.CursorShape getCurrentCursorShape() const
281 	{
282 		checkClassBinding!(typeof(this))();
283 		return ptrcall!(Input.CursorShape)(GDNativeClassBinding.getCurrentCursorShape, _godot_object);
284 	}
285 	/**
286 	Returns the gravity of the device's accelerometer sensor, if the device has one. Otherwise, the method returns $(D constant Vector3.ZERO).
287 	$(B Note:) This method only works on Android and iOS. On other platforms, it always returns $(D constant Vector3.ZERO). On Android the unit of measurement for each axis is m/s² while on iOS it's a multiple of the Earth's gravitational acceleration `g` (~9.81 m/s²).
288 	*/
289 	Vector3 getGravity() const
290 	{
291 		checkClassBinding!(typeof(this))();
292 		return ptrcall!(Vector3)(GDNativeClassBinding.getGravity, _godot_object);
293 	}
294 	/**
295 	Returns the rotation rate in rad/s around a device's X, Y, and Z axes of the gyroscope sensor, if the device has one. Otherwise, the method returns $(D constant Vector3.ZERO).
296 	$(B Note:) This method only works on Android and iOS. On other platforms, it always returns $(D constant Vector3.ZERO).
297 	*/
298 	Vector3 getGyroscope() const
299 	{
300 		checkClassBinding!(typeof(this))();
301 		return ptrcall!(Vector3)(GDNativeClassBinding.getGyroscope, _godot_object);
302 	}
303 	/**
304 	Returns the current value of the joypad axis at given index (see $(D joysticklist)).
305 	*/
306 	double getJoyAxis(in long device, in long axis) const
307 	{
308 		checkClassBinding!(typeof(this))();
309 		return ptrcall!(double)(GDNativeClassBinding.getJoyAxis, _godot_object, device, axis);
310 	}
311 	/**
312 	Returns the index of the provided axis name.
313 	*/
314 	long getJoyAxisIndexFromString(in String axis)
315 	{
316 		checkClassBinding!(typeof(this))();
317 		return ptrcall!(long)(GDNativeClassBinding.getJoyAxisIndexFromString, _godot_object, axis);
318 	}
319 	/**
320 	Receives a $(D joysticklist) axis and returns its equivalent name as a string.
321 	*/
322 	String getJoyAxisString(in long axis_index)
323 	{
324 		checkClassBinding!(typeof(this))();
325 		return ptrcall!(String)(GDNativeClassBinding.getJoyAxisString, _godot_object, axis_index);
326 	}
327 	/**
328 	Returns the index of the provided button name.
329 	*/
330 	long getJoyButtonIndexFromString(in String button)
331 	{
332 		checkClassBinding!(typeof(this))();
333 		return ptrcall!(long)(GDNativeClassBinding.getJoyButtonIndexFromString, _godot_object, button);
334 	}
335 	/**
336 	Receives a gamepad button from $(D joysticklist) and returns its equivalent name as a string.
337 	*/
338 	String getJoyButtonString(in long button_index)
339 	{
340 		checkClassBinding!(typeof(this))();
341 		return ptrcall!(String)(GDNativeClassBinding.getJoyButtonString, _godot_object, button_index);
342 	}
343 	/**
344 	Returns a SDL2-compatible device GUID on platforms that use gamepad remapping. Returns `"Default Gamepad"` otherwise.
345 	*/
346 	String getJoyGuid(in long device) const
347 	{
348 		checkClassBinding!(typeof(this))();
349 		return ptrcall!(String)(GDNativeClassBinding.getJoyGuid, _godot_object, device);
350 	}
351 	/**
352 	Returns the name of the joypad at the specified device index.
353 	*/
354 	String getJoyName(in long device)
355 	{
356 		checkClassBinding!(typeof(this))();
357 		return ptrcall!(String)(GDNativeClassBinding.getJoyName, _godot_object, device);
358 	}
359 	/**
360 	Returns the duration of the current vibration effect in seconds.
361 	*/
362 	double getJoyVibrationDuration(in long device)
363 	{
364 		checkClassBinding!(typeof(this))();
365 		return ptrcall!(double)(GDNativeClassBinding.getJoyVibrationDuration, _godot_object, device);
366 	}
367 	/**
368 	Returns the strength of the joypad vibration: x is the strength of the weak motor, and y is the strength of the strong motor.
369 	*/
370 	Vector2 getJoyVibrationStrength(in long device)
371 	{
372 		checkClassBinding!(typeof(this))();
373 		return ptrcall!(Vector2)(GDNativeClassBinding.getJoyVibrationStrength, _godot_object, device);
374 	}
375 	/**
376 	Returns the mouse speed for the last time the cursor was moved, and this until the next frame where the mouse moves. This means that even if the mouse is not moving, this function will still return the value of the last motion.
377 	*/
378 	Vector2 getLastMouseSpeed() const
379 	{
380 		checkClassBinding!(typeof(this))();
381 		return ptrcall!(Vector2)(GDNativeClassBinding.getLastMouseSpeed, _godot_object);
382 	}
383 	/**
384 	Returns the magnetic field strength in micro-Tesla for all axes of the device's magnetometer sensor, if the device has one. Otherwise, the method returns $(D constant Vector3.ZERO).
385 	$(B Note:) This method only works on Android, iOS and UWP. On other platforms, it always returns $(D constant Vector3.ZERO).
386 	*/
387 	Vector3 getMagnetometer() const
388 	{
389 		checkClassBinding!(typeof(this))();
390 		return ptrcall!(Vector3)(GDNativeClassBinding.getMagnetometer, _godot_object);
391 	}
392 	/**
393 	Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together.
394 	*/
395 	long getMouseButtonMask() const
396 	{
397 		checkClassBinding!(typeof(this))();
398 		return ptrcall!(long)(GDNativeClassBinding.getMouseButtonMask, _godot_object);
399 	}
400 	/**
401 	Returns the mouse mode. See the constants for more information.
402 	*/
403 	Input.MouseMode getMouseMode() const
404 	{
405 		checkClassBinding!(typeof(this))();
406 		return ptrcall!(Input.MouseMode)(GDNativeClassBinding.getMouseMode, _godot_object);
407 	}
408 	/**
409 	Returns `true` when the user starts pressing the action event, meaning it's `true` only on the frame that the user pressed down the button.
410 	This is useful for code that needs to run only once when an action is pressed, instead of every frame while it's pressed.
411 	*/
412 	bool isActionJustPressed(in String action) const
413 	{
414 		checkClassBinding!(typeof(this))();
415 		return ptrcall!(bool)(GDNativeClassBinding.isActionJustPressed, _godot_object, action);
416 	}
417 	/**
418 	Returns `true` when the user stops pressing the action event, meaning it's `true` only on the frame that the user released the button.
419 	*/
420 	bool isActionJustReleased(in String action) const
421 	{
422 		checkClassBinding!(typeof(this))();
423 		return ptrcall!(bool)(GDNativeClassBinding.isActionJustReleased, _godot_object, action);
424 	}
425 	/**
426 	Returns `true` if you are pressing the action event. Note that if an action has multiple buttons assigned and more than one of them is pressed, releasing one button will release the action, even if some other button assigned to this action is still pressed.
427 	*/
428 	bool isActionPressed(in String action) const
429 	{
430 		checkClassBinding!(typeof(this))();
431 		return ptrcall!(bool)(GDNativeClassBinding.isActionPressed, _godot_object, action);
432 	}
433 	/**
434 	Returns `true` if you are pressing the joypad button (see $(D joysticklist)).
435 	*/
436 	bool isJoyButtonPressed(in long device, in long button) const
437 	{
438 		checkClassBinding!(typeof(this))();
439 		return ptrcall!(bool)(GDNativeClassBinding.isJoyButtonPressed, _godot_object, device, button);
440 	}
441 	/**
442 	Returns `true` if the system knows the specified device. This means that it sets all button and axis indices exactly as defined in $(D joysticklist). Unknown joypads are not expected to match these constants, but you can still retrieve events from them.
443 	*/
444 	bool isJoyKnown(in long device)
445 	{
446 		checkClassBinding!(typeof(this))();
447 		return ptrcall!(bool)(GDNativeClassBinding.isJoyKnown, _godot_object, device);
448 	}
449 	/**
450 	Returns `true` if you are pressing the key. You can pass a $(D keylist) constant.
451 	*/
452 	bool isKeyPressed(in long scancode) const
453 	{
454 		checkClassBinding!(typeof(this))();
455 		return ptrcall!(bool)(GDNativeClassBinding.isKeyPressed, _godot_object, scancode);
456 	}
457 	/**
458 	Returns `true` if you are pressing the mouse button specified with $(D buttonlist).
459 	*/
460 	bool isMouseButtonPressed(in long button) const
461 	{
462 		checkClassBinding!(typeof(this))();
463 		return ptrcall!(bool)(GDNativeClassBinding.isMouseButtonPressed, _godot_object, button);
464 	}
465 	/**
466 	Notifies the $(D Input) singleton that a connection has changed, to update the state for the `device` index.
467 	This is used internally and should not have to be called from user scripts. See $(D joyConnectionChanged) for the signal emitted when this is triggered internally.
468 	*/
469 	void joyConnectionChanged(in long device, in bool connected, in String name, in String guid)
470 	{
471 		checkClassBinding!(typeof(this))();
472 		ptrcall!(void)(GDNativeClassBinding.joyConnectionChanged, _godot_object, device, connected, name, guid);
473 	}
474 	/**
475 	Feeds an $(D InputEvent) to the game. Can be used to artificially trigger input events from code. Also generates $(D Node._input) calls.
476 	Example:
477 	
478 	
479 	var a = InputEventAction.new()
480 	a.action = "ui_cancel"
481 	a.pressed = true
482 	Input.parse_input_event(a)
483 	
484 	
485 	*/
486 	void parseInputEvent(InputEvent event)
487 	{
488 		checkClassBinding!(typeof(this))();
489 		ptrcall!(void)(GDNativeClassBinding.parseInputEvent, _godot_object, event);
490 	}
491 	/**
492 	Removes all mappings from the internal database that match the given GUID.
493 	*/
494 	void removeJoyMapping(in String guid)
495 	{
496 		checkClassBinding!(typeof(this))();
497 		ptrcall!(void)(GDNativeClassBinding.removeJoyMapping, _godot_object, guid);
498 	}
499 	/**
500 	Sets a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing `null` to the image parameter resets to the system cursor. See $(D cursorshape) for the list of shapes.
501 	`image`'s size must be lower than 256×256.
502 	`hotspot` must be within `image`'s size.
503 	$(B Note:) $(D AnimatedTexture)s aren't supported as custom mouse cursors. If using an $(D AnimatedTexture), only the first frame will be displayed.
504 	$(B Note:) Only images imported with the $(B Lossless), $(B Lossy) or $(B Uncompressed) compression modes are supported. The $(B Video RAM) compression mode can't be used for custom cursors.
505 	*/
506 	void setCustomMouseCursor(Resource image, in long shape = 0, in Vector2 hotspot = Vector2(0, 0))
507 	{
508 		checkClassBinding!(typeof(this))();
509 		ptrcall!(void)(GDNativeClassBinding.setCustomMouseCursor, _godot_object, image, shape, hotspot);
510 	}
511 	/**
512 	Sets the default cursor shape to be used in the viewport instead of $(D constant CURSOR_ARROW).
513 	$(B Note:) If you want to change the default cursor shape for $(D Control)'s nodes, use $(D Control.mouseDefaultCursorShape) instead.
514 	$(B Note:) This method generates an $(D InputEventMouseMotion) to update cursor immediately.
515 	*/
516 	void setDefaultCursorShape(in long shape = 0)
517 	{
518 		checkClassBinding!(typeof(this))();
519 		ptrcall!(void)(GDNativeClassBinding.setDefaultCursorShape, _godot_object, shape);
520 	}
521 	/**
522 	Sets the mouse mode. See the constants for more information.
523 	*/
524 	void setMouseMode(in long mode)
525 	{
526 		checkClassBinding!(typeof(this))();
527 		ptrcall!(void)(GDNativeClassBinding.setMouseMode, _godot_object, mode);
528 	}
529 	/**
530 	Enables or disables the accumulation of similar input events sent by the operating system. When input accumulation is enabled, all input events generated during a frame will be merged and emitted when the frame is done rendering. Therefore, this limits the number of input method calls per second to the rendering FPS.
531 	Input accumulation is enabled by default. It can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. In applications where drawing freehand lines is required, input accumulation should generally be disabled while the user is drawing the line to get results that closely follow the actual input.
532 	*/
533 	void setUseAccumulatedInput(in bool enable)
534 	{
535 		checkClassBinding!(typeof(this))();
536 		ptrcall!(void)(GDNativeClassBinding.setUseAccumulatedInput, _godot_object, enable);
537 	}
538 	/**
539 	Starts to vibrate the joypad. Joypads usually come with two rumble motors, a strong and a weak one. `weak_magnitude` is the strength of the weak motor (between 0 and 1) and `strong_magnitude` is the strength of the strong motor (between 0 and 1). `duration` is the duration of the effect in seconds (a duration of 0 will try to play the vibration indefinitely).
540 	$(B Note:) Not every hardware is compatible with long effect durations; it is recommended to restart an effect if it has to be played for more than a few seconds.
541 	*/
542 	void startJoyVibration(in long device, in double weak_magnitude, in double strong_magnitude, in double duration = 0)
543 	{
544 		checkClassBinding!(typeof(this))();
545 		ptrcall!(void)(GDNativeClassBinding.startJoyVibration, _godot_object, device, weak_magnitude, strong_magnitude, duration);
546 	}
547 	/**
548 	Stops the vibration of the joypad.
549 	*/
550 	void stopJoyVibration(in long device)
551 	{
552 		checkClassBinding!(typeof(this))();
553 		ptrcall!(void)(GDNativeClassBinding.stopJoyVibration, _godot_object, device);
554 	}
555 	/**
556 	Vibrate Android and iOS devices.
557 	$(B Note:) It needs `VIBRATE` permission for Android at export settings. iOS does not support duration.
558 	*/
559 	void vibrateHandheld(in long duration_ms = 500)
560 	{
561 		checkClassBinding!(typeof(this))();
562 		ptrcall!(void)(GDNativeClassBinding.vibrateHandheld, _godot_object, duration_ms);
563 	}
564 	/**
565 	Sets the mouse position to the specified vector.
566 	*/
567 	void warpMousePosition(in Vector2 to)
568 	{
569 		checkClassBinding!(typeof(this))();
570 		ptrcall!(void)(GDNativeClassBinding.warpMousePosition, _godot_object, to);
571 	}
572 }
573 /// Returns: the InputSingleton
574 @property @nogc nothrow pragma(inline, true)
575 InputSingleton Input()
576 {
577 	checkClassBinding!InputSingleton();
578 	return InputSingleton(InputSingleton.GDNativeClassBinding._singleton);
579 }