1 module armos.events.events; 2 import armos.events; 3 import armos.utils; 4 5 struct SetupEvent{} 6 struct UpdateEvent{} 7 struct DrawEvent{} 8 struct ExitEvent{} 9 10 struct KeyPressedEvent{ 11 this(in KeyType key){this.key = key;} 12 KeyType key; 13 } 14 15 struct KeyReleasedEvent{ 16 this(in KeyType key){this.key = key;} 17 KeyType key; 18 } 19 // 20 struct UnicodeInputtedEvent{ 21 this(in uint key){this.key = key;} 22 uint key; 23 } 24 25 private mixin template MouseEvent(){ 26 int x, y, button; 27 this(in int x, in int y, in int button){ 28 this.x = x; 29 this.y = y; 30 this.button = button; 31 }; 32 } 33 struct MouseEnteredEvent{mixin MouseEvent;} 34 struct MouseExitedEvent{mixin MouseEvent;} 35 struct MouseMovedEvent{mixin MouseEvent;} 36 struct MousePressedEvent{mixin MouseEvent;} 37 struct MouseReleasedEvent{mixin MouseEvent;} 38 39 struct MouseScrolledEvent{ 40 this(in double xOffset, in double yOffset){ 41 this.xOffset = xOffset; 42 this.yOffset = yOffset; 43 } 44 double xOffset; 45 double yOffset; 46 } 47 48 struct MouseDraggedEvent{ 49 mixin MouseEvent; 50 int firstX, firstY; 51 } 52 53 private mixin template TouchEvent(){ 54 int x, y, id; 55 this(in int x, in int y, in int id){ 56 this.x = x; 57 this.y = y; 58 this.id = id; 59 }; 60 } 61 // 62 struct TouchCancelledEvent{mixin TouchEvent;} 63 struct TouchDoubleTapEvent{mixin TouchEvent;} 64 struct TouchDownEvent{mixin TouchEvent;} 65 struct TouchMovedEvent{mixin TouchEvent;} 66 struct TouchUpEvent{mixin TouchEvent;} 67 68 struct WindowResizeEvent{ 69 int w, h; 70 this(in int w, in int h){ 71 this.w = w; 72 this.h = h; 73 } 74 }