1 /**
2 Input event for gamepad buttons.
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.inputeventjoypadbutton;
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 for gamepad buttons.
28 
29 Input event type for gamepad buttons. For joysticks see $(D InputEventJoypadMotion).
30 */
31 @GodotBaseClass struct InputEventJoypadButton
32 {
33 	enum string _GODOT_internal_name = "InputEventJoypadButton";
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_button_index") GodotMethod!(void, long) setButtonIndex;
44 		@GodotName("get_button_index") GodotMethod!(long) getButtonIndex;
45 		@GodotName("set_pressure") GodotMethod!(void, double) setPressure;
46 		@GodotName("get_pressure") GodotMethod!(double) getPressure;
47 		@GodotName("set_pressed") GodotMethod!(void, bool) setPressed;
48 	}
49 	bool opEquals(in InputEventJoypadButton other) const { return _godot_object.ptr is other._godot_object.ptr; }
50 	InputEventJoypadButton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
51 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
52 	mixin baseCasts;
53 	static InputEventJoypadButton _new()
54 	{
55 		static godot_class_constructor constructor;
56 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventJoypadButton");
57 		if(constructor is null) return typeof(this).init;
58 		return cast(InputEventJoypadButton)(constructor());
59 	}
60 	@disable new(size_t s);
61 	/**
62 	
63 	*/
64 	void setButtonIndex(in long button_index)
65 	{
66 		checkClassBinding!(typeof(this))();
67 		ptrcall!(void)(_classBinding.setButtonIndex, _godot_object, button_index);
68 	}
69 	/**
70 	
71 	*/
72 	long getButtonIndex() const
73 	{
74 		checkClassBinding!(typeof(this))();
75 		return ptrcall!(long)(_classBinding.getButtonIndex, _godot_object);
76 	}
77 	/**
78 	
79 	*/
80 	void setPressure(in double pressure)
81 	{
82 		checkClassBinding!(typeof(this))();
83 		ptrcall!(void)(_classBinding.setPressure, _godot_object, pressure);
84 	}
85 	/**
86 	
87 	*/
88 	double getPressure() const
89 	{
90 		checkClassBinding!(typeof(this))();
91 		return ptrcall!(double)(_classBinding.getPressure, _godot_object);
92 	}
93 	/**
94 	
95 	*/
96 	void setPressed(in bool pressed)
97 	{
98 		checkClassBinding!(typeof(this))();
99 		ptrcall!(void)(_classBinding.setPressed, _godot_object, pressed);
100 	}
101 	/**
102 	Button identifier. One of the `JOY_BUTTON_*` constants from $(D @GlobalScope).
103 	*/
104 	@property long buttonIndex()
105 	{
106 		return getButtonIndex();
107 	}
108 	/// ditto
109 	@property void buttonIndex(long v)
110 	{
111 		setButtonIndex(v);
112 	}
113 	/**
114 	Represents the pressure the user puts on the button with his finger, if the controller supports it. Ranges from `0` to `1`.
115 	*/
116 	@property double pressure()
117 	{
118 		return getPressure();
119 	}
120 	/// ditto
121 	@property void pressure(double v)
122 	{
123 		setPressure(v);
124 	}
125 	/**
126 	If `true` the button's state is pressed. If `false` the button's state is released.
127 	*/
128 	@property bool pressed()
129 	{
130 		return isPressed();
131 	}
132 	/// ditto
133 	@property void pressed(bool v)
134 	{
135 		setPressed(v);
136 	}
137 }