1 /**
2 Input event type for gamepad joysticks and other motions. For buttons see `InputEventJoypadButton`.
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.inputeventjoypadmotion;
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.inputevent;
24 import godot.resource;
25 import godot.reference;
26 /**
27 Input event type for gamepad joysticks and other motions. For buttons see `InputEventJoypadButton`.
28 
29 Stores information about joystick motions. One `InputEventJoypadMotion` represents one axis at a time.
30 */
31 @GodotBaseClass struct InputEventJoypadMotion
32 {
33 	enum string _GODOT_internal_name = "InputEventJoypadMotion";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; InputEvent _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_axis") GodotMethod!(void, long) setAxis;
44 		@GodotName("get_axis") GodotMethod!(long) getAxis;
45 		@GodotName("set_axis_value") GodotMethod!(void, double) setAxisValue;
46 		@GodotName("get_axis_value") GodotMethod!(double) getAxisValue;
47 	}
48 	bool opEquals(in InputEventJoypadMotion other) const { return _godot_object.ptr is other._godot_object.ptr; }
49 	InputEventJoypadMotion opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
50 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
51 	mixin baseCasts;
52 	static InputEventJoypadMotion _new()
53 	{
54 		static godot_class_constructor constructor;
55 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventJoypadMotion");
56 		if(constructor is null) return typeof(this).init;
57 		return cast(InputEventJoypadMotion)(constructor());
58 	}
59 	@disable new(size_t s);
60 	/**
61 	
62 	*/
63 	void setAxis(in long axis)
64 	{
65 		checkClassBinding!(typeof(this))();
66 		ptrcall!(void)(_classBinding.setAxis, _godot_object, axis);
67 	}
68 	/**
69 	
70 	*/
71 	long getAxis() const
72 	{
73 		checkClassBinding!(typeof(this))();
74 		return ptrcall!(long)(_classBinding.getAxis, _godot_object);
75 	}
76 	/**
77 	
78 	*/
79 	void setAxisValue(in double axis_value)
80 	{
81 		checkClassBinding!(typeof(this))();
82 		ptrcall!(void)(_classBinding.setAxisValue, _godot_object, axis_value);
83 	}
84 	/**
85 	
86 	*/
87 	double getAxisValue() const
88 	{
89 		checkClassBinding!(typeof(this))();
90 		return ptrcall!(double)(_classBinding.getAxisValue, _godot_object);
91 	}
92 	/**
93 	Axis identifier. Use one of the `JOY_AXIS_*` constants in $(D @GlobalScope).
94 	*/
95 	@property long axis()
96 	{
97 		return getAxis();
98 	}
99 	/// ditto
100 	@property void axis(long v)
101 	{
102 		setAxis(v);
103 	}
104 	/**
105 	Current position of the joystick on the given axis. The value ranges from `-1.0` to `1.0`. A value of `0` means the axis is in its resting position.
106 	*/
107 	@property double axisValue()
108 	{
109 		return getAxisValue();
110 	}
111 	/// ditto
112 	@property void axisValue(double v)
113 	{
114 		setAxisValue(v);
115 	}
116 }