1 /**
2 Input event type for actions.
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.inputeventaction;
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 actions.
28 
29 Contains a generic action which can be targeted from several type of inputs. Actions can be created from the project settings menu `Project > Project Settings > Input Map`. See $(D Node._input).
30 */
31 @GodotBaseClass struct InputEventAction
32 {
33 	enum string _GODOT_internal_name = "InputEventAction";
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_action") GodotMethod!(void, String) setAction;
44 		@GodotName("get_action") GodotMethod!(String) getAction;
45 		@GodotName("set_pressed") GodotMethod!(void, bool) setPressed;
46 	}
47 	bool opEquals(in InputEventAction other) const { return _godot_object.ptr is other._godot_object.ptr; }
48 	InputEventAction opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
49 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
50 	mixin baseCasts;
51 	static InputEventAction _new()
52 	{
53 		static godot_class_constructor constructor;
54 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventAction");
55 		if(constructor is null) return typeof(this).init;
56 		return cast(InputEventAction)(constructor());
57 	}
58 	@disable new(size_t s);
59 	/**
60 	
61 	*/
62 	void setAction(StringArg0)(in StringArg0 action)
63 	{
64 		checkClassBinding!(typeof(this))();
65 		ptrcall!(void)(_classBinding.setAction, _godot_object, action);
66 	}
67 	/**
68 	
69 	*/
70 	String getAction() const
71 	{
72 		checkClassBinding!(typeof(this))();
73 		return ptrcall!(String)(_classBinding.getAction, _godot_object);
74 	}
75 	/**
76 	
77 	*/
78 	void setPressed(in bool pressed)
79 	{
80 		checkClassBinding!(typeof(this))();
81 		ptrcall!(void)(_classBinding.setPressed, _godot_object, pressed);
82 	}
83 	/**
84 	The action's name. Actions are accessed via this $(D String).
85 	*/
86 	@property String action()
87 	{
88 		return getAction();
89 	}
90 	/// ditto
91 	@property void action(String v)
92 	{
93 		setAction(v);
94 	}
95 	/**
96 	If `true` the action's state is pressed. If `false` the action's state is released.
97 	*/
98 	@property bool pressed()
99 	{
100 		return isPressed();
101 	}
102 	/// ditto
103 	@property void pressed(bool v)
104 	{
105 		setPressed(v);
106 	}
107 }