1 /** 2 * Copyright: Copyright (C) 2018 Gabriel Gheorghe, All Rights Reserved 3 * Authors: $(Gabriel Gheorghe) 4 * License: $(LINK2 https://www.gnu.org/licenses/gpl-3.0.txt, GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007) 5 * Source: $(LINK2 https://github.com/GabyForceQ/LibertyEngine/blob/master/source/liberty/input/profiler/data.d) 6 * Documentation: 7 * Coverage: 8 **/ 9 module liberty.input.profiler.data; 10 11 import liberty.input.joystick; 12 import liberty.input.keyboard; 13 import liberty.input.mouse; 14 15 /** 16 * 17 **/ 18 struct InputAction(DEVICE) { 19 static if (is(DEVICE == Keyboard)) { 20 /** 21 * 22 **/ 23 alias DeviceButton = KeyboardButton; 24 /** 25 * 26 **/ 27 alias DeviceAction = KeyboardAction; 28 } else static if (is(DEVICE == Mouse)) { 29 /** 30 * 31 **/ 32 alias DeviceButton = MouseButton; 33 /** 34 * 35 **/ 36 alias DeviceAction = MouseAction; 37 } else static if (is(DEVICE == Joystick)) { 38 /** 39 * 40 **/ 41 alias DeviceButton = JoystickButton; 42 /** 43 * 44 **/ 45 alias DeviceAction = JoystickAction; 46 } else 47 static assert(0, "Device not supported."); 48 49 /** 50 * 51 **/ 52 DeviceButton button; 53 54 /** 55 * 56 **/ 57 DeviceAction action; 58 59 /** 60 * 61 **/ 62 this(DeviceButton button, DeviceAction action) { 63 this.button = button; 64 this.action = action; 65 } 66 } 67 68 /** 69 * 70 **/ 71 struct InputAxis(DEVICE) { 72 static if (is(DEVICE == Keyboard)) 73 /** 74 * 75 **/ 76 alias DeviceAxis = KeyboardAxis; 77 else static if (is(DEVICE == Mouse)) 78 /** 79 * 80 **/ 81 alias DeviceAxis = MouseAxis; 82 else static if (is(DEVICE == Joystick)) 83 /** 84 * 85 **/ 86 alias DeviceAxis = JoystickAxis; 87 else 88 static assert(0, "Device not supported."); 89 90 /** 91 * 92 **/ 93 DeviceAxis axis; 94 95 /** 96 * 97 **/ 98 float scale; 99 100 /** 101 * 102 **/ 103 this(DeviceAxis axis, float scale) { 104 this.axis = axis; 105 this.scale = scale; 106 } 107 }