1 /** 2 Input event type for screen drag events. Only available on mobile devices. 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.inputeventscreendrag; 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.classdb; 24 import godot.inputevent; 25 import godot.resource; 26 /** 27 Input event type for screen drag events. Only available on mobile devices. 28 29 Contains screen drag information. See $(D Node._input). 30 */ 31 @GodotBaseClass struct InputEventScreenDrag 32 { 33 package(godot) enum string _GODOT_internal_name = "InputEventScreenDrag"; 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 GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_index") GodotMethod!(long) getIndex; 44 @GodotName("get_position") GodotMethod!(Vector2) getPosition; 45 @GodotName("get_relative") GodotMethod!(Vector2) getRelative; 46 @GodotName("get_speed") GodotMethod!(Vector2) getSpeed; 47 @GodotName("set_index") GodotMethod!(void, long) setIndex; 48 @GodotName("set_position") GodotMethod!(void, Vector2) setPosition; 49 @GodotName("set_relative") GodotMethod!(void, Vector2) setRelative; 50 @GodotName("set_speed") GodotMethod!(void, Vector2) setSpeed; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in InputEventScreenDrag other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of InputEventScreenDrag. 65 /// Note: use `memnew!InputEventScreenDrag` instead. 66 static InputEventScreenDrag _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventScreenDrag"); 70 if(constructor is null) return typeof(this).init; 71 return cast(InputEventScreenDrag)(constructor()); 72 } 73 @disable new(size_t s); 74 /** 75 76 */ 77 long getIndex() const 78 { 79 checkClassBinding!(typeof(this))(); 80 return ptrcall!(long)(GDNativeClassBinding.getIndex, _godot_object); 81 } 82 /** 83 84 */ 85 Vector2 getPosition() const 86 { 87 checkClassBinding!(typeof(this))(); 88 return ptrcall!(Vector2)(GDNativeClassBinding.getPosition, _godot_object); 89 } 90 /** 91 92 */ 93 Vector2 getRelative() const 94 { 95 checkClassBinding!(typeof(this))(); 96 return ptrcall!(Vector2)(GDNativeClassBinding.getRelative, _godot_object); 97 } 98 /** 99 100 */ 101 Vector2 getSpeed() const 102 { 103 checkClassBinding!(typeof(this))(); 104 return ptrcall!(Vector2)(GDNativeClassBinding.getSpeed, _godot_object); 105 } 106 /** 107 108 */ 109 void setIndex(in long index) 110 { 111 checkClassBinding!(typeof(this))(); 112 ptrcall!(void)(GDNativeClassBinding.setIndex, _godot_object, index); 113 } 114 /** 115 116 */ 117 void setPosition(in Vector2 position) 118 { 119 checkClassBinding!(typeof(this))(); 120 ptrcall!(void)(GDNativeClassBinding.setPosition, _godot_object, position); 121 } 122 /** 123 124 */ 125 void setRelative(in Vector2 relative) 126 { 127 checkClassBinding!(typeof(this))(); 128 ptrcall!(void)(GDNativeClassBinding.setRelative, _godot_object, relative); 129 } 130 /** 131 132 */ 133 void setSpeed(in Vector2 speed) 134 { 135 checkClassBinding!(typeof(this))(); 136 ptrcall!(void)(GDNativeClassBinding.setSpeed, _godot_object, speed); 137 } 138 /** 139 The drag event index in the case of a multi-drag event. 140 */ 141 @property long index() 142 { 143 return getIndex(); 144 } 145 /// ditto 146 @property void index(long v) 147 { 148 setIndex(v); 149 } 150 /** 151 The drag position. 152 */ 153 @property Vector2 position() 154 { 155 return getPosition(); 156 } 157 /// ditto 158 @property void position(Vector2 v) 159 { 160 setPosition(v); 161 } 162 /** 163 The drag position relative to its start position. 164 */ 165 @property Vector2 relative() 166 { 167 return getRelative(); 168 } 169 /// ditto 170 @property void relative(Vector2 v) 171 { 172 setRelative(v); 173 } 174 /** 175 The drag speed. 176 */ 177 @property Vector2 speed() 178 { 179 return getSpeed(); 180 } 181 /// ditto 182 @property void speed(Vector2 v) 183 { 184 setSpeed(v); 185 } 186 }