1 /** 2 Input event type for mouse motion events. 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.inputeventmousemotion; 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.inputeventmouse; 24 import godot.inputeventwithmodifiers; 25 import godot.inputevent; 26 import godot.resource; 27 import godot.reference; 28 /** 29 Input event type for mouse motion events. 30 31 Contains mouse motion information. Supports relative, absolute positions and speed. See $(D Node._input). 32 */ 33 @GodotBaseClass struct InputEventMouseMotion 34 { 35 enum string _GODOT_internal_name = "InputEventMouseMotion"; 36 public: 37 @nogc nothrow: 38 union { godot_object _godot_object; InputEventMouse _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_relative") GodotMethod!(void, Vector2) setRelative; 46 @GodotName("get_relative") GodotMethod!(Vector2) getRelative; 47 @GodotName("set_speed") GodotMethod!(void, Vector2) setSpeed; 48 @GodotName("get_speed") GodotMethod!(Vector2) getSpeed; 49 } 50 bool opEquals(in InputEventMouseMotion other) const { return _godot_object.ptr is other._godot_object.ptr; } 51 InputEventMouseMotion opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 52 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 53 mixin baseCasts; 54 static InputEventMouseMotion _new() 55 { 56 static godot_class_constructor constructor; 57 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventMouseMotion"); 58 if(constructor is null) return typeof(this).init; 59 return cast(InputEventMouseMotion)(constructor()); 60 } 61 @disable new(size_t s); 62 /** 63 64 */ 65 void setRelative(in Vector2 relative) 66 { 67 checkClassBinding!(typeof(this))(); 68 ptrcall!(void)(_classBinding.setRelative, _godot_object, relative); 69 } 70 /** 71 72 */ 73 Vector2 getRelative() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(Vector2)(_classBinding.getRelative, _godot_object); 77 } 78 /** 79 80 */ 81 void setSpeed(in Vector2 speed) 82 { 83 checkClassBinding!(typeof(this))(); 84 ptrcall!(void)(_classBinding.setSpeed, _godot_object, speed); 85 } 86 /** 87 88 */ 89 Vector2 getSpeed() const 90 { 91 checkClassBinding!(typeof(this))(); 92 return ptrcall!(Vector2)(_classBinding.getSpeed, _godot_object); 93 } 94 /** 95 Mouse position relative to the previous position (position at the last frame). 96 */ 97 @property Vector2 relative() 98 { 99 return getRelative(); 100 } 101 /// ditto 102 @property void relative(Vector2 v) 103 { 104 setRelative(v); 105 } 106 /** 107 Mouse speed. 108 */ 109 @property Vector2 speed() 110 { 111 return getSpeed(); 112 } 113 /// ditto 114 @property void speed(Vector2 v) 115 { 116 setSpeed(v); 117 } 118 }