1 /** 2 Input event type for screen drag events. 3 (only available on mobile devices) 4 5 Copyright: 6 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 7 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 8 Copyright (c) 2017-2018 Godot-D contributors 9 10 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 11 12 13 */ 14 module godot.inputeventscreendrag; 15 import std.meta : AliasSeq, staticIndexOf; 16 import std.traits : Unqual; 17 import godot.d.meta; 18 import godot.core; 19 import godot.c; 20 import godot.d.bind; 21 import godot.d.reference; 22 import godot.object; 23 import godot.classdb; 24 import godot.inputevent; 25 import godot.resource; 26 import godot.reference; 27 /** 28 Input event type for screen drag events. 29 (only available on mobile devices) 30 31 Contains screen drag information. See $(D Node._input). 32 */ 33 @GodotBaseClass struct InputEventScreenDrag 34 { 35 enum string _GODOT_internal_name = "InputEventScreenDrag"; 36 public: 37 @nogc nothrow: 38 union { godot_object _godot_object; InputEvent _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct _classBinding 43 { 44 __gshared: 45 @GodotName("set_index") GodotMethod!(void, long) setIndex; 46 @GodotName("get_index") GodotMethod!(long) getIndex; 47 @GodotName("set_position") GodotMethod!(void, Vector2) setPosition; 48 @GodotName("get_position") GodotMethod!(Vector2) getPosition; 49 @GodotName("set_relative") GodotMethod!(void, Vector2) setRelative; 50 @GodotName("get_relative") GodotMethod!(Vector2) getRelative; 51 @GodotName("set_speed") GodotMethod!(void, Vector2) setSpeed; 52 @GodotName("get_speed") GodotMethod!(Vector2) getSpeed; 53 } 54 bool opEquals(in InputEventScreenDrag other) const { return _godot_object.ptr is other._godot_object.ptr; } 55 InputEventScreenDrag opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 56 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 57 mixin baseCasts; 58 static InputEventScreenDrag _new() 59 { 60 static godot_class_constructor constructor; 61 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventScreenDrag"); 62 if(constructor is null) return typeof(this).init; 63 return cast(InputEventScreenDrag)(constructor()); 64 } 65 @disable new(size_t s); 66 /** 67 68 */ 69 void setIndex(in long index) 70 { 71 checkClassBinding!(typeof(this))(); 72 ptrcall!(void)(_classBinding.setIndex, _godot_object, index); 73 } 74 /** 75 76 */ 77 long getIndex() const 78 { 79 checkClassBinding!(typeof(this))(); 80 return ptrcall!(long)(_classBinding.getIndex, _godot_object); 81 } 82 /** 83 84 */ 85 void setPosition(in Vector2 position) 86 { 87 checkClassBinding!(typeof(this))(); 88 ptrcall!(void)(_classBinding.setPosition, _godot_object, position); 89 } 90 /** 91 92 */ 93 Vector2 getPosition() const 94 { 95 checkClassBinding!(typeof(this))(); 96 return ptrcall!(Vector2)(_classBinding.getPosition, _godot_object); 97 } 98 /** 99 100 */ 101 void setRelative(in Vector2 relative) 102 { 103 checkClassBinding!(typeof(this))(); 104 ptrcall!(void)(_classBinding.setRelative, _godot_object, relative); 105 } 106 /** 107 108 */ 109 Vector2 getRelative() const 110 { 111 checkClassBinding!(typeof(this))(); 112 return ptrcall!(Vector2)(_classBinding.getRelative, _godot_object); 113 } 114 /** 115 116 */ 117 void setSpeed(in Vector2 speed) 118 { 119 checkClassBinding!(typeof(this))(); 120 ptrcall!(void)(_classBinding.setSpeed, _godot_object, speed); 121 } 122 /** 123 124 */ 125 Vector2 getSpeed() const 126 { 127 checkClassBinding!(typeof(this))(); 128 return ptrcall!(Vector2)(_classBinding.getSpeed, _godot_object); 129 } 130 /** 131 Drag event index in the case of a multi-drag event. 132 */ 133 @property long index() 134 { 135 return getIndex(); 136 } 137 /// ditto 138 @property void index(long v) 139 { 140 setIndex(v); 141 } 142 /** 143 Drag position. 144 */ 145 @property Vector2 position() 146 { 147 return getPosition(); 148 } 149 /// ditto 150 @property void position(Vector2 v) 151 { 152 setPosition(v); 153 } 154 /** 155 Drag position relative to its start position. 156 */ 157 @property Vector2 relative() 158 { 159 return getRelative(); 160 } 161 /// ditto 162 @property void relative(Vector2 v) 163 { 164 setRelative(v); 165 } 166 /** 167 Drag speed. 168 */ 169 @property Vector2 speed() 170 { 171 return getSpeed(); 172 } 173 /// ditto 174 @property void speed(Vector2 v) 175 { 176 setSpeed(v); 177 } 178 }