//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System.Runtime.CompilerServices; namespace bs { /** @addtogroup Input-Editor * @{ */ /// /// Handles virtual input that allows you to receive virtual input events that hide the actual physical input, allowing /// you to easily change the input keys while being transparent to the external code. /// /// /// Companion class to for use in editor only. Supplies events that trigger regardless /// whether game is playing or not (unlike ) which makes them usable for editor only scripts. /// Pollable input and other functionality should still be accessed on . /// public static class EditorVirtualInput { public delegate void OnButtonEventDelegate(VirtualButton btn, int deviceIdx); /// /// Triggered when a physical button combination corresponding to a virtual button is pressed. /// public static event OnButtonEventDelegate OnButtonDown; /// /// Triggered when a physical button combination corresponding to a virtual button is released. /// public static event OnButtonEventDelegate OnButtonUp; /// /// Triggered every frame while a physical button combination corresponding to a virtual button is being held down. /// public static event OnButtonEventDelegate OnButtonHeld; /// /// Triggered by the runtime when the virtual button is pressed. /// /// Virtual button that was pressed. /// Index of the device the button was pressed on. private static void Internal_TriggerButtonDown(VirtualButton button, int deviceIdx) { if (OnButtonDown != null) OnButtonDown(button, deviceIdx); } /// /// Triggered by the runtime when the virtual button is released. /// /// Virtual button that was released. /// Index of the device the button was released on. private static void Internal_TriggerButtonUp(VirtualButton button, int deviceIdx) { if (OnButtonUp != null) OnButtonUp(button, deviceIdx); } /// /// Triggered by the runtime every frame while a virtual button is being held down. /// /// Virtual button that is being held down. /// Index of the device the button is being held down on. private static void Internal_TriggerButtonHeld(VirtualButton button, int deviceIdx) { if (OnButtonHeld != null) OnButtonHeld(button, deviceIdx); } }; /** @} */ }